const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
entry: './includes/index.js',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_debugger: true,
drop_console: true,
pure_funcs: ['console.log'] // 删除打印语句
},
format: {
comments: false // 删除所有注释
}
},
parallel: true, // 多核打包,提升打包速度
extractComments: false // 是否将注释全部集中到一个文件中
})
]
},
output: {
path: path.resolve(__dirname, 'pages/dist'),
filename: 'bundle.js'
}
}
webpack 打包基础 配置
最新推荐文章于 2025-03-03 22:23:35 发布