Commit 709536d5f1996a7a497ebeb937296cbc806c3bdd
1 parent
cc2faed2
关闭生产环境 打印和代码map块
Showing
1 changed file
with
5 additions
and
2 deletions
webintroduce/build/webpack.prod.conf.js
| ... | ... | @@ -35,7 +35,10 @@ const webpackConfig = merge(baseWebpackConfig, { |
| 35 | 35 | new UglifyJsPlugin({ |
| 36 | 36 | uglifyOptions: { |
| 37 | 37 | compress: { |
| 38 | - warnings: false | |
| 38 | + warnings: false, | |
| 39 | + drop_debugger: true,//console | |
| 40 | + drop_console: true, | |
| 41 | + pure_funcs: ['console.log']//移除console | |
| 39 | 42 | } |
| 40 | 43 | }, |
| 41 | 44 | sourceMap: config.build.productionSourceMap, |
| ... | ... | @@ -46,7 +49,7 @@ const webpackConfig = merge(baseWebpackConfig, { |
| 46 | 49 | filename: utils.assetsPath('css/[name].[contenthash].css'), |
| 47 | 50 | // Setting the following option to `false` will not extract CSS from codesplit chunks. |
| 48 | 51 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. |
| 49 | - // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, | |
| 52 | + // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, | |
| 50 | 53 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 |
| 51 | 54 | allChunks: true, |
| 52 | 55 | }), | ... | ... |