1
- const HtmlWebPackPlugin = require ( " html-webpack-plugin" ) ;
2
- const BundleAnalyzerPlugin = require ( 'webpack-bundle-analyzer' ) . BundleAnalyzerPlugin ;
3
- const MiniCssExtractPlugin = require ( " mini-css-extract-plugin" ) ;
1
+ const HtmlWebPackPlugin = require ( ' html-webpack-plugin' ) ;
2
+ const { BundleAnalyzerPlugin } = require ( 'webpack-bundle-analyzer' ) ;
3
+ const MiniCssExtractPlugin = require ( ' mini-css-extract-plugin' ) ;
4
4
5
5
const devMode = process . env . NODE_ENV !== 'production' ;
6
6
const htmlWebpackPlugin = new HtmlWebPackPlugin ( {
7
- template : " ./src/index.html" ,
8
- filename : " ./index.html"
7
+ template : ' ./src/index.html' ,
8
+ filename : ' ./index.html' ,
9
9
} ) ;
10
10
11
11
module . exports = {
@@ -15,39 +15,39 @@ module.exports = {
15
15
test : / \. j s $ / ,
16
16
exclude : / n o d e _ m o d u l e s / ,
17
17
use : {
18
- loader : " babel-loader"
19
- }
18
+ loader : ' babel-loader' ,
19
+ } ,
20
20
} ,
21
21
{
22
22
test : / \. j s x $ / ,
23
23
exclude : / n o d e _ m o d u l e s / ,
24
24
use : {
25
- loader : " babel-loader"
26
- }
25
+ loader : ' babel-loader' ,
26
+ } ,
27
27
} ,
28
28
{
29
29
test : / \. c s s $ / ,
30
30
use : [
31
31
MiniCssExtractPlugin . loader ,
32
- " css-loader"
33
- ]
32
+ ' css-loader' ,
33
+ ] ,
34
34
} ,
35
35
{
36
36
test : / \. s ? [ a c ] s s $ / ,
37
37
use : [
38
- devMode ? 'style-loader' : MiniCssExtractPlugin . loader ,
39
- 'css-loader' ,
40
- 'sass-loader' ,
38
+ devMode ? 'style-loader' : MiniCssExtractPlugin . loader ,
39
+ 'css-loader' ,
40
+ 'sass-loader' ,
41
41
] ,
42
42
} ,
43
- ]
43
+ ] ,
44
44
} ,
45
45
plugins : [
46
46
htmlWebpackPlugin ,
47
- // new BundleAnalyzerPlugin(),
47
+ new BundleAnalyzerPlugin ( ) ,
48
48
new MiniCssExtractPlugin ( {
49
49
filename : devMode ? '[name].css' : '[name].[hash].css' ,
50
50
chunkFilename : devMode ? '[id].css' : '[id].[hash].css' ,
51
- } )
52
- ]
51
+ } ) ,
52
+ ] ,
53
53
} ;
0 commit comments