I don't have uglifyJS in my webpack config, but for some reason the output does seem minified:

I don't really need minification, and would like to disable it. Does anyone have an idea where minification is enabled in the first place?
Hi @tommedema , do you use Webpack 4?
They have changed the semantics there. If you set mode: "production" in your webpack config with Webpack 4, minification is enabled by default (together with other more useful optimization algorithms 馃槃 )
If you use Webpack 4 + serverless-webpack 5.0.0, you should set the follwing in your webpack config:
mode: slsw.lib.webpack.isLocal ? "development": "production",
optimization: {
// We no not want to minimize our code.
minimize: false
},
Then you end up with optimized, but not minified code. The conditional mode switch enables all debugging extensions automatically when running locally with invoke local or serverless-offline but gives you better code when deployed.
BTW: The new configuration options are not documented really well in the Webpack documentation (and hard to find at all), but I found a quite good explanation here: https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a that helped us to understand how we should configure our projects now.
This is excellent, thanks a ton!
where to find the webpack config
Most helpful comment
Hi @tommedema , do you use Webpack 4?
They have changed the semantics there. If you set
mode: "production"in your webpack config with Webpack 4, minification is enabled by default (together with other more useful optimization algorithms 馃槃 )If you use Webpack 4 + serverless-webpack 5.0.0, you should set the follwing in your webpack config:
Then you end up with optimized, but not minified code. The conditional mode switch enables all debugging extensions automatically when running locally with
invoke localorserverless-offlinebut gives you better code when deployed.