@@ -15,6 +15,7 @@ const BrotliPlugin = require('brotli-webpack-plugin')
15
15
const env = require ( '../config/prod.env' )
16
16
17
17
const webpackConfig = merge ( baseWebpackConfig , {
18
+ mode : 'production' ,
18
19
module : {
19
20
rules : utils . styleLoaders ( {
20
21
sourceMap : config . build . productionSourceMap ,
@@ -44,7 +45,7 @@ const webpackConfig = merge(baseWebpackConfig, {
44
45
} ) ,
45
46
// extract css into its own file
46
47
new ExtractTextPlugin ( {
47
- filename : utils . assetsPath ( 'css/[name].[contenthash ].css' ) ,
48
+ filename : utils . assetsPath ( 'css/[name].[hash ].css' ) ,
48
49
// Setting the following option to `false` will not extract CSS from codesplit chunks.
49
50
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
50
51
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
@@ -79,35 +80,6 @@ const webpackConfig = merge(baseWebpackConfig, {
79
80
new webpack . HashedModuleIdsPlugin ( ) ,
80
81
// enable scope hoisting
81
82
new webpack . optimize . ModuleConcatenationPlugin ( ) ,
82
- // split vendor js into its own file
83
- new webpack . optimize . CommonsChunkPlugin ( {
84
- name : 'vendor' ,
85
- minChunks ( module ) {
86
- // any required modules inside node_modules are extracted to vendor
87
- return (
88
- module . resource &&
89
- / \. j s $ / . test ( module . resource ) &&
90
- module . resource . indexOf (
91
- path . join ( __dirname , '../node_modules' )
92
- ) === 0
93
- )
94
- }
95
- } ) ,
96
- // extract webpack runtime and module manifest to its own file in order to
97
- // prevent vendor hash from being updated whenever app bundle is updated
98
- new webpack . optimize . CommonsChunkPlugin ( {
99
- name : 'manifest' ,
100
- minChunks : Infinity
101
- } ) ,
102
- // This instance extracts shared chunks from code splitted chunks and bundles them
103
- // in a separate chunk, similar to the vendor chunk
104
- // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
105
- new webpack . optimize . CommonsChunkPlugin ( {
106
- name : 'app' ,
107
- async : 'vendor-async' ,
108
- children : true ,
109
- minChunks : 3
110
- } ) ,
111
83
112
84
// copy custom static assets
113
85
new CopyWebpackPlugin ( [
@@ -127,7 +99,12 @@ const webpackConfig = merge(baseWebpackConfig, {
127
99
minRatio : 0.8 ,
128
100
quality : 11 ,
129
101
} )
130
- ]
102
+ ] ,
103
+ optimization : {
104
+ splitChunks : {
105
+ chunks : "all"
106
+ }
107
+ }
131
108
} )
132
109
133
110
if ( config . build . productionGzip ) {
0 commit comments