How to fix grunt-contrib-uglify for ES6
If are usings Grunt, you may noticed that grunt-contrib-uglify
module doesn't work if the scripts are written in ES6, the new standard version of Javascript.
Official response
The module grunt-contrib-uglify
does not offer ES6 native support yet π€― but at least it's included in the harmony
branch.
How to add support to ES6
Just install the harmony
branch π¨βπ»
npm install gruntjs/grunt-contrib-uglify#harmony --save
And then update the module in your Gruntfile.js
file.
πWhere before you have:
grunt.loadNpmTasks('grunt-contrib-uglify');
βοΈ Set to:
grunt.loadNpmTasks('grunt-contrib-uglify-es');
Note the change is to add -es
at the end of the name.
Done! That's all π€