chore:refine build:prod
This commit is contained in:
parent
98604af104
commit
073b7219ff
2 changed files with 17 additions and 6 deletions
|
@ -21,7 +21,8 @@ exports.cssLoaders = function (options) {
|
|||
}
|
||||
|
||||
var postcssLoader = {
|
||||
loader: 'postcss-loader'
|
||||
loader: 'postcss-loader',
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
|
||||
// generate loader string to be used with extract text plugin
|
||||
|
|
|
@ -82,7 +82,7 @@ var webpackConfig = merge(baseWebpackConfig, {
|
|||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks: function (module, count) {
|
||||
minChunks: function (module) {
|
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return (
|
||||
module.resource &&
|
||||
|
@ -93,6 +93,12 @@ var webpackConfig = merge(baseWebpackConfig, {
|
|||
)
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
}),
|
||||
// split echarts into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
async: 'echarts',
|
||||
|
@ -109,12 +115,16 @@ var webpackConfig = merge(baseWebpackConfig, {
|
|||
return context && (context.indexOf('xlsx') >= 0);
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
chunks: ['vendor']
|
||||
name: 'app',
|
||||
async: 'vendor-async',
|
||||
children: true,
|
||||
minChunks: 3
|
||||
}),
|
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
|
|
Loading…
Reference in a new issue