How to build minified and uncompressed bundle with webpack?

前端 未结 14 1173
囚心锁ツ
囚心锁ツ 2020-11-29 14:52

Here\'s my webpack.config.js

var webpack = require(\"webpack\");

module.exports = {

  entry: \"./entry.js\",
  devtool: \"source-map\",
  outp         


        
14条回答
  •  孤街浪徒
    2020-11-29 15:35

    According with this line: https://github.com/pingyuanChen/webpack-uglify-js-plugin/blob/master/index.js#L117

    should be something like:

    var webpack = require("webpack");
    
    module.exports = {
    
      entry: "./entry.js",
      devtool: "source-map",
      output: {
        path: "./dist",
        filename: "bundle.js"
      },
      plugins: [
        new webpack.optimize.UglifyJsPlugin({
         minimize: true,
         compress: false
        })
      ]
    };
    

    Indeed you can have multiple builds by exporting different configs according your env / argv strategies.

提交回复
热议问题