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

JS variable renaming breaks scripts #326

Closed
simonmicro opened this issue Sep 4, 2020 · 2 comments
Closed

JS variable renaming breaks scripts #326

simonmicro opened this issue Sep 4, 2020 · 2 comments

Comments

@simonmicro
Copy link

simonmicro commented Sep 4, 2020

minify triggers an Unexpected identifier syntax error with the code below...

var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
var something = 42;
something++;
for (let i = 0; i < 10; i++) {
    let badboy = 10;
    badboy++;
}

It results in...

var something=42,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a;something++;for(let a=0;a<10;a++)let b=10,b++

Note that the variable a is both used in the var AND let scope and causes an syntax error (test it here)!

Or to put it into the tools own words:

ERROR: cannot minify /app/src/examplenew.js: unexpected b in expression on line 1 and column 107
    1: ...omething++;for(let a=0;a<10;a++)let b=10,b++

When I don't mix var and let it works fine...

I must admit that we use this wonderful tool also at work and yeah... It broke our release version for about 10 minutes - very not good...

@tdewolff
Copy link
Owner

tdewolff commented Sep 4, 2020

Should be fixed in v2.9.4

It broke our release version for about 10 minutes - very not good...

You can pay for support if this is critical to your product. Otherwise, I'm happy to accept PRs for bug fixes!

@simonmicro
Copy link
Author

Should be fixed in v2.9.4

Thank you for your very fast response and fix!

Otherwise, I'm happy to accept PRs for bug fixes!

I guess I'll need to learn Go... 🤣

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

2 participants