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