@@ -2,18 +2,16 @@ import webpack from 'webpack';
2
2
import path from 'path' ;
3
3
import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
4
4
import HtmlWebpackPlugin from 'html-webpack-plugin' ;
5
- import OptimizeCSSAssetsPlugin from 'optimize-css-assets-webpack-plugin' ;
6
5
7
- const vendors = [ 'react' , 'react-dom' ] ;
8
- const isProduction = process . env . NODE_ENV === 'production' ;
6
+ const vendor = [ 'react' , 'react-dom' ] ;
9
7
10
8
export default {
11
9
name : 'client' ,
12
- mode : isProduction ? 'production' : 'development ',
10
+ mode : 'production' ,
13
11
target : 'web' ,
14
12
entry : {
15
13
bundle : './entry.js' ,
16
- vendors ,
14
+ vendor ,
17
15
} ,
18
16
context : path . join ( __dirname , 'src' ) ,
19
17
@@ -22,8 +20,6 @@ export default {
22
20
children : false ,
23
21
} ,
24
22
25
- devtool : isProduction ? false : 'inline-cheap-module-eval-source-map' ,
26
-
27
23
output : {
28
24
path : path . join ( __dirname , 'target' , 'build' ) ,
29
25
filename : '[name].js' ,
@@ -51,47 +47,41 @@ export default {
51
47
optimization : {
52
48
splitChunks : {
53
49
cacheGroups : {
50
+ // Don't generate automatic common chunks
54
51
default : false ,
52
+ // Don't generate automatic vendor chunks
53
+ vendors : false ,
55
54
// Custom common chunk
56
55
bundle : {
57
56
name : 'commons' ,
58
57
chunks : 'all' ,
59
58
minChunks : 3 ,
60
59
reuseExistingChunk : false ,
61
60
} ,
62
- // Customer vendor
63
- vendors : {
61
+ // Custom vendor chunk by name
62
+ vendor : {
64
63
chunks : 'initial' ,
65
- name : 'vendors ' ,
66
- test : 'vendors ' ,
64
+ name : 'vendor ' ,
65
+ test : 'vendor ' ,
67
66
} ,
68
67
// Merge all the CSS into one file
69
68
styles : {
70
69
name : 'styles' ,
71
70
test : / \. s ? c s s $ / ,
72
71
chunks : 'all' ,
73
72
minChunks : 1 ,
74
- reuseExistingChunk : true ,
75
73
enforce : true ,
76
74
} ,
77
75
} ,
78
76
} ,
79
77
} ,
80
- profile : false ,
81
78
82
79
plugins : [
83
- new webpack . optimize . ModuleConcatenationPlugin ( ) ,
84
80
new MiniCssExtractPlugin ( {
85
81
filename : '[name].css' ,
86
82
chunkFilename : '[name].css' ,
87
83
} ) ,
88
- new OptimizeCSSAssetsPlugin ( ) ,
89
84
new HtmlWebpackPlugin ( {
90
- minify : {
91
- collapseWhitespace : true ,
92
- preserveLineBreaks : true ,
93
- removeComments : true ,
94
- } ,
95
85
filename : 'index.html' ,
96
86
template : path . join ( __dirname , 'src' , 'index.html' ) ,
97
87
} ) ,
0 commit comments