I'm using gruntjs
(which uses uglifyjs
) to build my Angularjs
app. But uglifyjs
still does not support es6, so in corresponding GitHub issue i found this. So now there is uglify-es, which seemingly supports es6. But I'm not sure how to integrate it with grunt. Now i have module "grunt-contrib-uglify"
, which has a dependency uglifyjs
, which is now used. How can i make grunt use uglify-es
instead?
How to integrate uglify-es in grunt?
Asked Answered
2023 UPD: this answer may be outdated, according to some comments. Didn't have time to check
I've achived this by installing the harmony branch of grunt-contrib-uglify
, which supports es6:
npm install git://github.com/gruntjs/grunt-contrib-uglify.git#harmony --save-dev
Is this still the way to use for es6. I tried installing the above module and got a Permission denied on /var/root/.npm/_cacache/tmp/git-clone-5257398a npm ERR! /private/var/root/.npm/_cacache/tmp/git-clone-5257398a/.git I changed the permission to 777 for /var/root/.npm/_cacache/tmp/ but still end up with the error –
Noontime
@jitenshah, do you have an error when just installing grunt-contrib-uglify, not specific branch? npm install grunt-contrib-uglify --save-dev –
Masterstroke
No. I was able to install it easily. Even though I was in # prompt --> I ran your command with sudo like : sudo npm install git://github.com/gruntjs/grunt-contrib-uglify.git#harmony --save-dev and I was able to get the work done. –
Noontime
This answer saved my day. –
Helix
its locked and cant be installed –
Thread
The ECMAScript version has finally been released. You can now get the same result with the official version (it's no longer needed to pick it from GitHub)
npm install grunt-contrib-uglify-es --save-dev
Thank you for sharing this :) –
Meyerbeer
Though the accepted answer solves the problem, this is the better and stable one than the accepted one, possibly because it is the more up-to-date solution. –
Hatchel
It's weird that it says 'This packed has been deprecated' but thx. –
Cenotaph
because it is deprecated, it doesnt work for me –
Thread
© 2022 - 2024 — McMap. All rights reserved.