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:


✍️ Set to:


Note the change is to add -es at the end of the name.

Done! That's all 🤘

David Burgos

Read more posts by this author.