-
Notifications
You must be signed in to change notification settings - Fork 944
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
Using Uglify-JS debug prints wrong logs (with "color: #XXXXX" string) #547
Comments
I'm trying to make a tiny project that shows the problem. |
After hours trying to reproduce the issue in a fresh project, I've realized that the issue was due to the fucxxxx NPM is becoming really a pain nowadays... Sorry for the noise. |
what's your uglifyjs config? I have same issue here. I set collapse_vars to false to avoid this issue before, but it's not working now. |
No one, I just use |
Hi there, @miaulightouch did you find a solution for this? |
it's required to disable {
compress: {
collapse_vars: false
}
} |
Thanks for the answer, sorry for the delay. I was using Browserify when I asked my question with uglifiify running uglify-js and could not find a way of directly passing options like |
It would be good if this was documented, its an obscure hack to work around this issue with debug, and its unlikely people will find it in this closed issue. Even more obscure if you don't explicitly use Uglify, just the default webpack. I had to add the following to get it to work.
|
When using tools like angular-cli, |
It would be even greater if libraries worked fine without depending on specific settings in other libraries. I think that's better than "make it work for my use case, plz". |
This issue is not really closed ... could be great to re-opened it |
We're not doing anything crazy, here. We're not pushing Javascript to its limits, we're not expecting any weird or new syntax to work (at least, not until v4 when we switched to ES6). If UglifyJS is messing up code, that's its own fault. Please open a ticket there. It is not the job of a library like this to conform to random tools such as UglifyJS. They are supposed to accommodate the libraries upon which they operate, not the other way around. There is nothing actionable on Or you can use something more modern and active, such as Babel or Terser. |
AFAIR I've no longer seen this issue by using Terser. 100% agreed with @qix. |
We just tell that the printf syntax is unusable in minified version in browser, with a product out of the box and widely used like webpack (18.5M download) / uglify (35.1M). The answer of Uglify, we will know it, there is an option for that. Someone tell that it will cost 5% of js size. Every byte so heavily win is important. |
This isn't a logger problem. UglifyJS is breaking your code. That should be setting off alarms and red flags for you.
You're welcome. Please take your attitude elsewhere. |
I use ES6 plus browserify plus Babel plus optional uglify-js.
Example to show the problem:
When I do NOT use
uglify-js
, everything is ok and the output is:However, when using `uglify-js, this happens:
Which clearly shows that some wrong value is interpolated into the whole string and, somehow,
"color: #CC9933"
is printed as first%s
argument.The text was updated successfully, but these errors were encountered: