-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 compress conditionals: increment erroneously not reached #3010
Comments
The repo used to track this down is here: https://github.com/sirreal/debug-debug It should be simple to checkout, |
Note that the issue does not manifest with |
There is a bug affecting at least our `debug` module. Disable until the issue is resolved: mishoo/UglifyJS#3010
Duplicate of #2908, fixed in 0c4f315c026e6, fix released in uglify-js@3.3.11, but never merged to the #2908 (comment) is interesting:
@alexlamsl Does that mean that |
uglify-es can still be useful even in this state by disabling the options that don't work for a given code base. You can try another ES6+ minifier, but every alternative has their own problems - whether it's a JVM dependency, configuration complexity, slowness, or bugs of their own. All such projects have the same lack of contributors. Anyone is free to fork uglify-es, apply patches, fix bugs, and maintain their own copy. People don't appreciate that this is an unpaid volunteer effort that requires a lot of work - and frankly, a lot of grief. |
@kzc I understand that open source work can be thankless. If anything on this issue has caused grief, you have my apologies 🙇 We all greatly appreciate this project and the amount of work that goes into it. It provides a lot of value for a lot of other projects ❤️💚💜💛 Please take the question at face value. If we know that |
@sirreal I think @kzc has already answered your query, but just to clarify:
(Note: I am not the only maintainer for this repository, so I can only speak for myself here.) |
Thanks for the information @alexlamsl 👍 |
@alexlamsl I'd like to better understand the relationship between the How hard would it be to regularly merge |
@sirreal No worries. No grief in this thread. @jsnajdr Your understanding is correct. The ES6+ In my opinion the only viable path forward for Merging |
@fabiosantoscode Just throwing the idea out there - ignore if you want... since you're the only active |
@kzc I think I could do it, as long as it's in this repository. I think managing a new package name or a new repository is not for me, but here I have more help from you and @alexlamsl. |
Fair enough. @mishoo or @rvanvelzen Could you please grant @fabiosantoscode commit rights to @alexlamsl Could you please grant @fabiosantoscode |
@fabiosantoscode as I stated repeatedly, I do not wish to get involved with the So the repeated suggestion by @kzc to fork that branch would be the best way forward. |
@alexlamsl got it. Renamed my repository to https://github.com/fabiosantoscode/uglify-es and made the master branch into what the harmony branch is in this repo. |
There is a bug affecting at least our `debug` module. Disable until the issue is resolved: mishoo/UglifyJS#3010
Disabling uglifyjs compress.collapse_vars option. Workaround for a known uglifyjs bug: mishoo/UglifyJS#3010
Reading through this thread, it sounds like a rebranding is necessary for the new project. @fabiosantoscode if we move forward with your fork, could we perhaps open an issue there to discuss naming further? As for support, if we end up using this fork in Rollup we can discuss what we might be able to do to help support it. Deciding on the organization repo and name to move forward with seems like the first step though towards these goals to me. |
@guybedford An npm package exists for the However, a number of patches have yet to applied. See comments in: Should anyone wish to fork |
It seems like no single individual wants to take this huge challenge on, but as a community effort it would be good to come up with a memorable name and place it in its own GitHub organization with multiple owners to avoid exactly the problem that has happened here happening again. No need to publicise anything at this point, but at least to provide a home for issues (issue queue not being open on @fabiosantoscode is also an issue...) and community PR contributions. I was hoping to start with brainstorming a name on @fabiosantoscode's fork in the issue queue there if it can be enabled. @kzc thanks for the patch list, I'm also happy to contribute where I can on these things, but once we've set up the structures to know patches aren't wasted effort. |
Created terser/terser#2. |
Verified to work in |
Bug report or feature request?
Bug report
ES5 or ES6+ input?
ES5 input using
uglify-es@3.3.9
Uglify version (
uglifyjs -V
)uglify-es 3.3.9
JavaScript input
The
uglifyjs
CLI command executed orminify()
options used.The issue is not observed when:
JavaScript output or error produced.
Detailed description
In the samples above, the input will produce:
The uglified (compressed conditionals) version will produce:
You can see that in the input,
index
will always be incremented. However, in the uglified output,index
is prefix-incremented only when"c" === letter
evaluates totrue
.This bug was discovered in Automattic/wp-calypso#21489
The following is the "real-life" code that exposed the bug:
https://github.com/visionmedia/debug/blob/22f993216dcdcee07eb0601ea71a917e4925a30a/src/browser.js#L90-L102
The bug was noticed in the result of applying
uglify-es
to the above code as part of a Webpack build using https://github.com/webpack-contrib/uglifyjs-webpack-plugin.Massive thanks to @ockham for help with this issue.
The text was updated successfully, but these errors were encountered: