猿问

webpack4打包如何去除console?

使用

new webpack.optimize.UglifyJsPlugin({     compress: {
         warnings: false,
         drop_debugger: true,
         drop_console: true
     }
)}

提示已经移除该方法,推荐使用minimize,minimize该如何去除console呢?


30秒到达战场
浏览 1328回答 1
1回答

GCT1015

用cssnano插件npm i -D @intervolga/optimize-cssnano-pluginconst optimizeCssnanoPlugin = require('@intervolga/optimize-cssnano-plugin');module.exports = {     plugins: [        new optimizeCssnanoPlugin({             cssnanoOptions: {                 preset: [                    'default',                     {                         discardComments: {                             removeAll: true,                         },                     }                 ],             },         })     ] };看错题了,这是压缩css,题主无视吧。。。
随时随地看视频慕课网APP

相关分类

Html5
我要回答