blendid
blendid copied to clipboard
Replace webpack's uglify with new uglify plugin to allow ES6 uglification
This change will automatically allow webpack to minify ES6 code.
Related to https://github.com/vigetlabs/blendid/issues/505
Alternatively, should it provide user a way to use their own uglify plugin?
webpackConfig.plugins.push(
new webpack.DefinePlugin(TASK_CONFIG.javascripts.production.definePlugin),
(webpackConfig.uglifyPlugin) // Allow the use of other uglifier
? new webpackConfig.uglifyPlugin(uglifyConfig)
: new webpack.optimize.UglifyJsPlugin(uglifyConfig),
new webpack.NoEmitOnErrorsPlugin()
)
Note:
This is a potential breaking change since UglifyJsPlugin require minifyOptions to be defined inside the uglifyOptions object. Ref: https://github.com/webpack-contrib/uglifyjs-webpack-plugin#uglifyoptions
Previously
uglifyConfig = {
compress: false,
mangle: false,
beautify: true,
comments: true,
sourceMap: true,
}
Now
uglifyConfig = {
uglifyOptions: {
compress: false,
mangle: false,
output: {
beautify: true,
comments: true,
},
},
sourceMap: true,
}