webpack 打包基础 配置

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,webpack,数学建模,前端)