vigetlabs / blendid

A delicious blend of gulp tasks combined into a configurable asset pipeline and static site builder
MIT License
4.97k stars 683 forks source link

Using Uglify-ES instead of Uglify... #505

Open macouella opened 6 years ago

macouella commented 6 years ago

Hello!

I've configured my babel-loader so that it outputs ES6 code (and not transpiled ES5). Can you please advise how I can replace uglify with uglify-es to process the built javascript/s?

Thanks!

amoshydra commented 6 years ago

I am not sure how to configure blendid to use uglify-es

however, the following is the change that can be made within blendid webpack-multi-config.js: Replace webpack.optimize.UglifyJsPlugin with UglifyJsPlugin (since it now uses uglify-es internally)

Original

    webpackConfig.plugins.push(
      new webpack.DefinePlugin(TASK_CONFIG.javascripts.production.definePlugin),
      new webpack.optimize.UglifyJsPlugin(uglifyConfig),
      new webpack.NoEmitOnErrorsPlugin()
    )

Changes

const UglifyJsPlugin  = require('uglifyjs-webpack-plugin')

...

    webpackConfig.plugins.push(
      new webpack.DefinePlugin(TASK_CONFIG.javascripts.production.definePlugin),
      new UglifyJsPlugin(uglifyConfig),
      new webpack.NoEmitOnErrorsPlugin()
    )