@@ -15,6 +15,7 @@ const BrotliPlugin = require('brotli-webpack-plugin')
1515const env = require ( '../config/prod.env' )
1616
1717const webpackConfig = merge ( baseWebpackConfig , {
18+ mode : 'production' ,
1819 module : {
1920 rules : utils . styleLoaders ( {
2021 sourceMap : config . build . productionSourceMap ,
@@ -44,7 +45,7 @@ const webpackConfig = merge(baseWebpackConfig, {
4445 } ) ,
4546 // extract css into its own file
4647 new ExtractTextPlugin ( {
47- filename : utils . assetsPath ( 'css/[name].[contenthash ].css' ) ,
48+ filename : utils . assetsPath ( 'css/[name].[hash ].css' ) ,
4849 // Setting the following option to `false` will not extract CSS from codesplit chunks.
4950 // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
5051 // 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, {
7980 new webpack . HashedModuleIdsPlugin ( ) ,
8081 // enable scope hoisting
8182 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- } ) ,
11183
11284 // copy custom static assets
11385 new CopyWebpackPlugin ( [
@@ -127,7 +99,12 @@ const webpackConfig = merge(baseWebpackConfig, {
12799 minRatio : 0.8 ,
128100 quality : 11 ,
129101 } )
130- ]
102+ ] ,
103+ optimization : {
104+ splitChunks : {
105+ chunks : "all"
106+ }
107+ }
131108} )
132109
133110if ( config . build . productionGzip ) {
0 commit comments