Skip to content

Commit 5923909

Browse files
GRIMMR3AP3RMarkPieszak
authored andcommitted
feat(webpack): fix extract-text-webpack-plugin deprecation
closes #645
1 parent 73e880f commit 5923909

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"zone.js": "^0.8.26"
6868
},
6969
"devDependencies": {
70+
"@angular-devkit/build-angular": "~0.6.6",
7071
"@angular/cli": "^6.0.5",
7172
"@angular/compiler-cli": "6.0.3",
7273
"@ngtools/webpack": "^6.0.5",
@@ -86,11 +87,10 @@
8687
"karma-remap-coverage": "^0.1.5",
8788
"karma-sourcemap-loader": "^0.3.7",
8889
"karma-webpack": "^2.0.4",
89-
"mini-css-extract-plugin": "0.4.0",
90+
"mini-css-extract-plugin": "^0.4.0",
9091
"tslint": "^5.10.0",
9192
"uglifyjs-webpack-plugin": "^1.2.5",
9293
"webpack-bundle-analyzer": "^2.13.1",
93-
"webpack-cli": "^2.1.4",
94-
"@angular-devkit/build-angular": "~0.6.6"
94+
"webpack-cli": "^2.1.4"
9595
}
9696
}

webpack.config.vendor.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ const allModules = treeShakableModules.concat(nonTreeShakableModules);
3030

3131
module.exports = (env) => {
3232
console.log(`env = ${JSON.stringify(env)}`)
33+
const extractCSS = new MiniCssExtractPlugin({
34+
// Options similar to the same options in webpackOptions.output
35+
// both options are optional
36+
filename: "[name].css",
37+
chunkFilename: "[id].css"
38+
});
3339
const isDevBuild = !(env && env.prod);
3440
const sharedConfig = {
3541
mode: isDevBuild ? "development" : "production",
@@ -70,7 +76,10 @@ module.exports = (env) => {
7076
module: {
7177
rules: [{
7278
test: /\.css(\?|$)/,
73-
use: ['style-loader', MiniCssExtractPlugin.loader, isDevBuild ? 'css-loader' : 'css-loader?minimize']
79+
use: [
80+
MiniCssExtractPlugin.loader,
81+
isDevBuild ? 'css-loader' : 'css-loader?minimize'
82+
]
7483
}]
7584
},
7685
plugins: [
@@ -118,7 +127,10 @@ module.exports = (env) => {
118127
module: {
119128
rules: [{
120129
test: /\.css(\?|$)/,
121-
use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize']
130+
use: [
131+
MiniCssExtractPlugin.loader,
132+
isDevBuild ? 'css-loader' : 'css-loader?minimize'
133+
]
122134
}]
123135
},
124136
plugins: [

0 commit comments

Comments
 (0)