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

Legal comment is removed when package is bundled and uglified #3

Closed
anddoutoi opened this issue Feb 9, 2016 · 0 comments
Closed

Legal comment is removed when package is bundled and uglified #3

anddoutoi opened this issue Feb 9, 2016 · 0 comments

Comments

@anddoutoi
Copy link

Hello,

I noticed that the legal comment is removed when this package is bundled (with browserify) and minified (with UglifyJS2).

Let me first say that this IS an issue in Uglify, see mishoo/UglifyJS#88 (comment) for more info. Uglify seems to fail adding the comment node to the AST. I post this issue more as FYI if you are concerned about userland honouring the legal stuff.

Testing this is pretty easy:

> browserify -r base-64 | uglifyjs --beautify --comments all

I also see this in https://github.com/mathiasbynens/utf8.js

The real solution would ofc to fix Uglify but the referenced issue above is old and I don't expect to see any fix soon.

By doing some shotgun debugging I found that moving the introductory semicolon to be the first character in the file, before the legal comment, makes Uglify parse it and make it a part of the AST. Also removing the semicolon renders the same result but makes the code vulnerable to other bundling processes like concatenation.

Tested with browserify@13.0.0 and uglify@2.6.1 but saw issue with older versions aswell.

Thanks for developing this package!

@anddoutoi anddoutoi closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
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

1 participant