11var  path  =  require ( "path" ) ; 
22var  webpack  =  require ( 'webpack' ) ; 
33var  BundleTracker  =  require ( 'webpack-bundle-tracker' ) ; 
4- var  SplitByPathPlugin  =  require ( 'webpack-split-by-path' ) ; 
5- var  ExtractTextPlugin  =  require ( "extract-text-webpack-plugin" ) ; 
4+ var  MiniCssExtractPlugin  =  require ( 'mini-css-extract-plugin' ) ; 
65
76
87module . exports  =  { 
@@ -15,26 +14,42 @@ module.exports = {
1514 } , 
1615
1716 plugins : [ 
18-  new  ExtractTextPlugin ( "styles.css" ) , 
19-  new  BundleTracker ( { filename : './webpack-stats.json' } ) , 
20-  new  SplitByPathPlugin ( [ 
21-  { 
22-  name : 'vendor' , 
23-  path : path . join ( __dirname ,  '/node_modules/' ) 
24-  } 
25-  ] ) 
17+  new  MiniCssExtractPlugin ( ) , 
18+  new  BundleTracker ( { path : __dirname ,  filename : './webpack-stats.json' } ) , 
2619 ] , 
2720
2821 module : { 
29-  loaders : [ 
22+  rules : [ 
3023 // we pass the output from babel loader to react-hot loader 
31-  {  test : / \. j s x ? $ / ,  exclude : / n o d e _ m o d u l e s / ,  loaders : [ 'babel' ] ,  } , 
32-  {  test : / \. c s s $ / ,  loader : ExtractTextPlugin . extract ( "style-loader" ,  "css-loader" )  } 
24+  { 
25+  test : / \. j s x ? $ / , 
26+  exclude : / n o d e _ m o d u l e s / , 
27+  use : { 
28+  loader : 'babel-loader' , 
29+  options : { 
30+  presets : [ '@babel/preset-react' ] 
31+  } 
32+  } 
33+  } , 
34+  {  test : / \. c s s $ / ,  use : [ MiniCssExtractPlugin . loader ,  'css-loader' ] ,  } 
3335 ] , 
3436 } , 
3537
3638 resolve : { 
37-  modulesDirectories : [ 'node_modules' ,  'bower_components' ] , 
38-  extensions : [ ''  ,   ' .js',  '.jsx' ] 
39+  modules : [ 'node_modules' ,  'bower_components' ] , 
40+  extensions : [ '.js' ,  '.jsx' ] 
3941 } , 
42+ 
43+  optimization : { 
44+  splitChunks : { 
45+  cacheGroups : { 
46+  commons : { 
47+  test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / , 
48+  name : 'vendors' , 
49+  chunks : 'all' , 
50+  enforce : true 
51+  } 
52+  } 
53+  } 
54+  } 
4055} 
0 commit comments