1
1
const path = require ( 'path' )
2
2
const webpack = require ( 'webpack' )
3
- const ExtractTextPlugin = require ( 'extract-text-webpack -plugin' )
3
+ const MiniCssExtractPlugin = require ( 'mini-css-extract -plugin' )
4
4
const { BundleAnalyzerPlugin } = require ( 'webpack-bundle-analyzer' )
5
5
6
6
module . exports = {
@@ -23,12 +23,16 @@ module.exports = {
23
23
} ,
24
24
plugins : [
25
25
new webpack . DefinePlugin ( { 'process.env.NODE_ENV' : JSON . stringify ( 'production' ) } ) ,
26
- new ExtractTextPlugin ( 'styles.css' ) ,
27
- new webpack
28
- . optimize
29
- . UglifyJsPlugin ( { sourceMap : true , exclude : / n o d e _ m o d u l e s / } ) ,
26
+ new MiniCssExtractPlugin ( {
27
+ // Options similar to the same options in webpackOptions.output
28
+ // both options are optional
29
+ filename : 'styles.css' ,
30
+ chunkFilename : '[id].css'
31
+ } ) ,
30
32
new BundleAnalyzerPlugin ( {
31
- analyzerMode : 'static' , openAnalyzer : false , generateStatsFile : true
33
+ analyzerMode : 'static' ,
34
+ openAnalyzer : false ,
35
+ generateStatsFile : true
32
36
} )
33
37
] ,
34
38
module : {
@@ -38,23 +42,23 @@ module.exports = {
38
42
loaders : [ 'babel-loader' ] ,
39
43
include : path . join ( __dirname , 'src' ) ,
40
44
exclude : / n o d e _ m o d u l e s /
41
- } , {
45
+ } ,
46
+ {
42
47
test : / \. c s s $ / ,
43
- use : ExtractTextPlugin . extract ( {
44
- use : [
45
- {
46
- loader : 'css-loader' ,
47
- options : {
48
- localIdentName : 'react-dropdown-tree-select__[local]--[hash:base64:5]' ,
49
- importLoaders : 1 ,
50
- minimize : true
51
- }
52
- } ,
53
- { loader : 'postcss-loader' }
54
- ]
55
- } ) ,
56
48
include : / s r c / ,
57
- exclude : / n o d e _ m o d u l e s /
49
+ exclude : / n o d e _ m o d u l e s / ,
50
+ use : [
51
+ MiniCssExtractPlugin . loader ,
52
+ {
53
+ loader : 'css-loader' ,
54
+ options : {
55
+ localIdentName : 'react-dropdown-tree-select__[local]--[hash:base64:5]' ,
56
+ importLoaders : 1 ,
57
+ minimize : true
58
+ }
59
+ } ,
60
+ { loader : 'postcss-loader' }
61
+ ]
58
62
}
59
63
]
60
64
}
0 commit comments