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-js 3.4.9 broke js-xlsx after #3243, now work just when conditionals is False #3309

Closed
upmauro opened this issue Jan 3, 2019 · 4 comments · Fixed by #3329
Closed

Comments

@upmauro
Copy link

upmauro commented Jan 3, 2019

Uglify version (uglifyjs -V)
3.4.9

I'm using a js-xlsx to generate files by javascript, by the way, after 3.4.9 update all XML's generated in client-side in UTF-8 with accents is translated to wrong encode, i'm trying create a separated snippet to demonstrate the problem.

The problem solves when conditionals inside compress is false.

I opened the issue before I got the demo just to get the problem going, which might be the same as other users.

Sorry my english.

@upmauro
Copy link
Author

upmauro commented Jan 3, 2019

The suspicious file is
https://github.com/SheetJS/js-xlsx/blob/master/dist/cpexcel.js

@victorguimaraessilva
Copy link

i have the same issue, in my enterprise we use js-xlsx and when we uglify the lib appears to be broken.

@gil-m
Copy link

gil-m commented Jan 10, 2019

Having the same problem here. Please fix or rollback!

@shaan1337
Copy link

I have a repro here (for at least one case, I don't know if there are others).

This code:

 return t?(e={},e.whatever='hello'):(e={},e.whatever='hello');

is minified to:

var e;return e.whatever=(e={},"hello")

This throws following error (since e.whatever is assigned before e is declared):

TypeError: Cannot set property 'whatever' of undefined
    at test (/home/shaan/.../uglify-bug/dist/file.js:1:103)
    at Object.<anonymous> (/home/shaan/.../uglify-bug/dist/file.js:1:120)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

Steps:

  1. Download and unpack file.js.zip
  2. node file.js (no error here)
  3. uglifyjs file.js -c > file.min.js
  4. node file.min.js (throws e undefined error)

Same code works fine with v3.4.8.

After a git bisect between v3.4.8 and v3.4.9, the following commit is responsible:
2bdaca1

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

Successfully merging a pull request may close this issue.

4 participants