Skip to content

Commit 73e880f

Browse files
info-lvsysMarkPieszak
authored andcommitted
feat(webpack): update to use mini-css-extract-plugin
#645
1 parent 1975d89 commit 73e880f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

webpack.config.vendor.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const webpack = require('webpack');
3-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
3+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
44
const merge = require('webpack-merge');
55
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
66
const treeShakableModules = [
@@ -30,7 +30,6 @@ const allModules = treeShakableModules.concat(nonTreeShakableModules);
3030

3131
module.exports = (env) => {
3232
console.log(`env = ${JSON.stringify(env)}`)
33-
const extractCSS = new ExtractTextPlugin('vendor.css');
3433
const isDevBuild = !(env && env.prod);
3534
const sharedConfig = {
3635
mode: isDevBuild ? "development" : "production",
@@ -71,13 +70,13 @@ module.exports = (env) => {
7170
module: {
7271
rules: [{
7372
test: /\.css(\?|$)/,
74-
use: extractCSS.extract({
75-
use: isDevBuild ? 'css-loader' : 'css-loader?minimize'
76-
})
73+
use: ['style-loader', MiniCssExtractPlugin.loader, isDevBuild ? 'css-loader' : 'css-loader?minimize']
7774
}]
7875
},
7976
plugins: [
80-
extractCSS,
77+
new MiniCssExtractPlugin({
78+
filename: 'vendor.css',
79+
}),
8180
new webpack.DllPlugin({
8281
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
8382
name: '[name]_[hash]'

0 commit comments

Comments
 (0)