refactor:refine webpack.prod.conf.js

This commit is contained in:
Pan 2017-11-09 18:17:08 +08:00
parent 61deec548c
commit 61095a9f2c
2 changed files with 4 additions and 6 deletions

View File

@ -1,10 +1,7 @@
{ {
"presets": [ "presets": [
["env", { ["env", {
"modules": false, "modules": false
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}], }],
"stage-2" "stage-2"
], ],

View File

@ -27,11 +27,10 @@ var webpackConfig = merge(baseWebpackConfig, {
output: { output: {
path: config.build.assetsRoot, path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'), filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js'), chunkFilename: utils.assetsPath('js/[name].[chunkhash].js'),
publicPath: config.build.assetsPublicPath publicPath: config.build.assetsPublicPath
}, },
plugins: [ plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
// http://vuejs.github.io/vue-loader/en/workflow/production.html // http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': env, 'process.env': env,
@ -77,6 +76,8 @@ var webpackConfig = merge(baseWebpackConfig, {
}), }),
// cache Module Identifiers // cache Module Identifiers
new webpack.HashedModuleIdsPlugin(), new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// 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',