Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uglify-es support on npm? #499

Closed
gkatsev opened this issue Dec 6, 2017 · 40 comments
Closed

uglify-es support on npm? #499

gkatsev opened this issue Dec 6, 2017 · 40 comments

Comments

@gkatsev
Copy link

gkatsev commented Dec 6, 2017

Hi, would it be possible to get the #harmony branch released on npm? Maybe in a grunt-contrib-uglify-es package similar to how uglify-es is released separately from uglifyjs?

Thanks for your hard work!

@frekele
Copy link

frekele commented Dec 22, 2017

or a version for example:

  • v3.2.1-harmony
  • v3.2.1-es
  • harmony-v3.2.1
  • es-v3.2.1

@frekele
Copy link

frekele commented Dec 22, 2017

for now I'm using it like this:

{
    "devDependencies": {
        "grunt-contrib-uglify": "github:gruntjs/grunt-contrib-uglify#harmony"
    }
}

but it would be cool as the @gkatsev said:

{
    "devDependencies": {
        "grunt-contrib-uglify-harmony": "^3.2.1"
    }
}

or

{
    "devDependencies": {
        "grunt-contrib-uglify": "^harmony-v3.2.1"
    }
}

Thank you.

@gkatsev
Copy link
Author

gkatsev commented Dec 22, 2017

I've used gruntjs/grunt-contrib-uglify#9315efca3bf977a35ce2f29ee34b00b14dafa171 to make sure that branch doesn't change from under me.
An npm tag would work too.

@frekele
Copy link

frekele commented Dec 22, 2017

My concern is exactly that, make sure I use a stable version.

Great tip @gkatsev , I will do it.

{
    "devDependencies": {
        "grunt-contrib-uglify": "github:gruntjs/grunt-contrib-uglify#9315efca3bf977a35ce2f29ee34b00b14dafa171 "
    }
}

Thank you.

@frekele
Copy link

frekele commented Dec 26, 2017

Hi @alexlamsl and @XhmikosR

Release the grunt-contrib-uglify with version: harmony-v3.3.2? Please.

@oychao
Copy link

oychao commented Dec 27, 2017

Hi @XhmikosR @alexlamsl
Why not publish the harmony branch to npm.

@samir-mahendra
Copy link

I need this as well.

I was using the "#harmony" branch in my npm, but due to some recent bug, 2 separate functions are getting uglified with the same signature, and thus breaking my release.

I cannot use a hastag for some reason in my environment. I am running in Docker (Ubuntu) with npm 5.5.1 and git 2.7.4, and my "npm install" fails with:

npm sill fetchPackageMetaData error for grunt-contrib-uglify@github:gruntjs/grunt-contrib-uglify#9315efca3bf977a35ce2f29ee34b00b14dafa171 Command failed: /usr/bin/git checkout 9315efc
npm sill fetchPackageMetaData fatal: reference is not a tree: 9315efc
npm sill fetchPackageMetaData
npm verb stack Error: Command failed: /usr/bin/git checkout 9315efc
npm verb stack fatal: reference is not a tree: 9315efc
npm verb stack
npm verb stack at ChildProcess.exithandler (child_process.js:275:12)
npm verb stack at emitTwo (events.js:126:13)
npm verb stack at ChildProcess.emit (events.js:214:7)
npm verb stack at maybeClose (internal/child_process.js:925:16)
npm verb stack at Socket.stream.socket.on (internal/child_process.js:346:11)
npm verb stack at emitOne (events.js:116:13)
npm verb stack at Socket.emit (events.js:211:7)
npm verb stack at Pipe._handle.close [as _onclose] (net.js:554:12)

@nyurik
Copy link

nyurik commented Dec 28, 2017

I also recently began experiencing uglification issues, and unable to build newer versions. Please publish a stable trackable version. gruntjs/grunt-contrib-uglify#9315efca3bf977a35ce2f29ee34b00b14dafa171 does not work -- npm fails with reference is not a tree. Thanks!

@XhmikosR
Copy link
Member

Just change the hash. This happens due to the rebase.

We'll need to do this differently since people are using the branch; when I made it, was just as an experiment.

@nyurik
Copy link

nyurik commented Dec 28, 2017

@XhmikosR I tried github:gruntjs/grunt-contrib-uglify#harmony and it npm installs fine, but the resulting code no longer runs in the browser.

@XhmikosR
Copy link
Member

Not sure how that can be related to grunt.

@alexlamsl
Copy link
Contributor

@nyurik that's an issue with uglify-es, the fix for which has been made and will be in the next release.

@XhmikosR
Copy link
Member

@alexlamsl: I think the best at this point would be if we made the harmony branch a separate package here too.

We'll need @vladikoff's help in order to publish it on npm though.

@alexlamsl
Copy link
Contributor

@XhmikosR no objection to a separate package - and we can keep the current rebase approach with the harmony branch.

@XhmikosR
Copy link
Member

@alexlamsl: can you you fetch the harmony branch and review it/try it live? The package should be now grunt-contrib-uglify-es.

We just need to be super careful with rebase not to have issues like the other time with master.

If all is good, then we need @vladikoff to publish the new package/git tag/relase and then you can do it for future releases.

@alexlamsl
Copy link
Contributor

@XhmikosR a quick npm test on html-minifier by modifying package.json and Gruntfile.js seems to function as expected.

We just need to be super careful with rebase not to have issues like the other time with master.

When I did git pull just now, I then have to do git reset --hard origin/harmony in order to get rid of the two extraneous merge commits that appear on my local branch - am I doing it right? 😅

@XhmikosR
Copy link
Member

Always do git fetch && git reset --hard origin/harmony before you try to do anything on the branch. Please do it one more time because I made one more small change, not sure if you picked it.

Alternatively we could just push and merge from master; this should be the safest, although messier.

@alexlamsl
Copy link
Contributor

Thanks for the lesson - that worked flawlessly 😉

@davideschiera
Copy link

I tried what suggested by @gkatsev, but unfortunately didn't work on my side (see below for error log).

I'm currently working around the issue by using a fork of this repository (https://github.com/davideschiera/grunt-contrib-uglify/tree/master) where master has been replaced by a branch created from 9315efc.

Is there a better way to refer to harmony branch on the official repository?

Thanks!

npm ERR! git rev-list -n1 9315efca3bf977a35ce2f29ee34b00b14dafa171: fatal: bad object 9315efca3bf977a35ce2f29ee34b00b14dafa171
npm ERR! git rev-list -n1 9315efca3bf977a35ce2f29ee34b00b14dafa171: 
npm ERR! git rev-list -n1 9315efca3bf977a35ce2f29ee34b00b14dafa171: fatal: bad object 9315efca3bf977a35ce2f29ee34b00b14dafa171
npm ERR! git rev-list -n1 9315efca3bf977a35ce2f29ee34b00b14dafa171: 
npm ERR! git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034: Cloning into bare repository '/home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034'...
npm ERR! git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034: Permission denied (publickey).
npm ERR! git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034: fatal: Could not read from remote repository.
npm ERR! git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034: 
npm ERR! git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034: Please make sure you have the correct access rights
npm ERR! git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034: and the repository exists.
npm ERR! Linux 4.9.51-10.52.amzn1.x86_64
npm ERR! argv "/home/user/.nvm/v6.2.2/bin/node" "/home/user/.nvm/v6.2.2/bin/npm" "install"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! code 128

npm ERR! Command failed: git clone --template=/home/user/.npm/_git-remotes/_templates --mirror git@github.com:gruntjs/grunt-contrib-uglify.git /home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034
npm ERR! Cloning into bare repository '/home/user/.npm/_git-remotes/git-github-com-gruntjs-grunt-contrib-uglify-git-9315efca3bf977a35ce2f29ee34b00b14dafa171-ddaa8034'...
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.

@XhmikosR
Copy link
Member

Just be patient until we publish it on npm. Otherwise clean your cache or make sure you are using the latest LTS 8.

@davideschiera
Copy link

Sounds good! And thanks a lot for taking care of this ;-)

@frekele
Copy link

frekele commented Dec 28, 2017

@davideschiera

use: grunt-contrib-uglify-es

{
    "devDependencies": {
        "grunt-contrib-uglify-es": "git+https://github.com/gruntjs/grunt-contrib-uglify.git#harmony",
    }
}

or

{
    "devDependencies": {
        "grunt-contrib-uglify-es": "git+https://github.com/gruntjs/grunt-contrib-uglify.git#ccb95a70cad6a4e9e902d3bd5d0e38a4de09a1e1",
    }
}

@davideschiera
Copy link

@frekele thanks for the suggestion!

Tried

  "devDependencies": {
    ...
    "grunt-contrib-uglify-es": "git+https://github.com/gruntjs/grunt-contrib-uglify.git#ccb95a70cad6a4e9e902d3bd5d0e38a4de09a1e1",

but got

jit-grunt: Plugin for the "uglify" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings

(node v8.9.3, npm v5.5.1)

:-/

@samueleastdev
Copy link

Manage to get this working by following this link.
https://stackoverflow.com/questions/44848273/how-to-integrate-uglify-es-in-grunt

@LeviRosol
Copy link

is there a functional commit that can be used while waiting for the npm update? I had been using #harmony w/o issue for months, and just now started failing. I've tried to look for older commits but can't seem to find one that works.

@gkatsev
Copy link
Author

gkatsev commented Dec 31, 2017

This treeish should work: ccb95a7

@LeviRosol
Copy link

LeviRosol commented Dec 31, 2017

@gkatsev I had tried that, also assuming it would be the ideal commit, but didn't have any luck. To clarify a few things;

Here's my package.json entry:

"grunt-contrib-uglify": "git://github.com/gruntjs/grunt-contrib-uglify.git#ccb95a70cad6a4e9e902d3bd5d0e38a4de09a1e1",

The error i get when running:

{ SyntaxError: Unexpected token: keyword (const)

and the offending line of code:

const string = require('string')

This error is what brought me to use the #harmony branch, but now it's as if it's magic is completely gone.

Am I missing something silly or are others having this same issue?

@alexlamsl
Copy link
Contributor

@LeviRosol seems to work with current version of uglify-es:

$ uglifyjs -V
uglify-es 3.3.4

$ echo 'const string = require("string")' | uglifyjs
const string=require("string");

If you hit an issue with uglify-es, please follow the guidelines and file at https://github.com/mishoo/UglifyJS2/issues

@LeviRosol
Copy link

I don't think my issue is there though.

Up until the latest release of grunt-contrib-uglify a few days ago, things were working as expected.

Am I missing something?

@LeviRosol
Copy link

Adding to the comment @frekele made, in addition to using either of his suggested package.json entries, you also need to update your grunt file to use uglify-es like so:

grunt.loadNpmTasks('grunt-contrib-uglify-es');

Pretty obvious oversight on my part, so posting here in hopes it saves someone else some time.

@gkatsev
Copy link
Author

gkatsev commented Jan 3, 2018

Yup, the new branch has renamed it grunt-contrib-uglify-es so you'll need to load it that way. I don't think the old commit had renamed it. https://www.npmjs.com/package/load-grunt-tasks would still be useful here since the task is still called uglify and it would've just loaded the correct new one.

@vladikoff
Copy link
Member

@XhmikosR do we still need to do this or do people use -es for now?

@gkatsev
Copy link
Author

gkatsev commented Jan 3, 2018

To clarify what I meant is that the package name in the #harmony branch (the ccb95a7 treeish) was renamed grunt-contrib-uglify-es: ccb95a7#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R2

@XhmikosR
Copy link
Member

XhmikosR commented Jan 4, 2018

@vladikoff: we need this published on npm as grunt-contib-uglify-es otherwise people will still have the same issues when the branch is rebased.

@Pamblam
Copy link

Pamblam commented Feb 2, 2018

two months.. it would take me 5 minutes to fork this and publish it on my own npm account.. why hasn't this been done yet..

@vladikoff
Copy link
Member

Published at https://www.npmjs.com/package/grunt-contrib-uglify-es

@XhmikosR adding you as contrib to that package

@XhmikosR
Copy link
Member

XhmikosR commented Feb 2, 2018

@vladikoff: you should give npm access to @alexlamsl too since he makes the uglify releases himself.

Assuming everyone's careful with rebasing, we shouldn't have any issues.

@gkatsev
Copy link
Author

gkatsev commented Feb 2, 2018

Thanks @vladikoff!

@vladikoff
Copy link
Member

@XhmikosR done!

@alexlamsl
Copy link
Contributor

@vladikoff @XhmikosR many thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests