This commit is contained in:
pubkey 2018-09-27 19:36:34 +02:00
parent 8d6647df99
commit ca319e3013
2 changed files with 9 additions and 26 deletions

View File

@ -27,6 +27,11 @@ var webpackConfig = merge(baseWebpackConfig, {
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
optimization: {
splitChunks: {
chunks: "all"
}
},
plugins: [
new VueLoaderPlugin(),
// http://vuejs.github.io/vue-loader/en/workflow/production.html
@ -35,7 +40,7 @@ var webpackConfig = merge(baseWebpackConfig, {
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css')
filename: utils.assetsPath('css/[name].[hash].css')
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
@ -49,8 +54,7 @@ var webpackConfig = merge(baseWebpackConfig, {
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing' ?
'index.html' :
config.build.index,
'index.html' : config.build.index,
template: 'index.html',
inject: true,
minify: {
@ -62,33 +66,12 @@ var webpackConfig = merge(baseWebpackConfig, {
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function(module, count) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 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
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
}),
})
]
})
if (config.build.productionGzip) {
var CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',

View File

@ -66,7 +66,7 @@
"eslint-plugin-standard": "4.0.0",
"eventsource-polyfill": "0.9.6",
"express": "4.16.3",
"extract-text-webpack-plugin": "3.0.2",
"extract-text-webpack-plugin": "4.0.0-beta.0",
"file-loader": "2.0.0",
"friendly-errors-webpack-plugin": "1.7.0",
"html-webpack-plugin": "3.2.0",