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 compression causes "invalid asm.js warning" #281

Closed
feross opened this issue Mar 17, 2015 · 2 comments
Closed

Uglify compression causes "invalid asm.js warning" #281

feross opened this issue Mar 17, 2015 · 2 comments

Comments

@feross
Copy link
Member

@feross feross commented Mar 17, 2015

WebTorrent uses simple-sha1 to create SHA1 hashes. simple-sha1 prefers the WebCrypto API but falls back to rusha (an asm.js SHA1 implementation) when WebCrypto is unavailable.

When building webtorrent.min.js, we compress and minify the code to save bytes, but the compression changes the rusha code in a way that makes it invalid asm.js.

srijs/rusha#27 (comment)
mishoo/UglifyJS2#167

Until the issue is fixed in uglify, we need to disable compression (i.e. change uglifyjs -c warnings=false -m to uglifyjs -m), increasing the gzipped file size from 45.7 kb to 46.5 kb - which is actually pretty negligible.

feross added a commit to webtorrent/instant.io that referenced this issue Mar 17, 2015
@feross feross closed this in 4a1a54f Mar 17, 2015
@norzak

This comment has been minimized.

Copy link

@norzak norzak commented Dec 25, 2017

I am getting following warning on Chrome using latest webtorrent.

Invalid asm.js: Expected function name

Is this related to this?

@norzak

This comment has been minimized.

Copy link

@norzak norzak commented Dec 25, 2017

Firefox gives a similar error

TypeError: asm.js type error: initializer of exported object literal must be name of function

@lock lock bot locked as resolved and limited conversation to collaborators May 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.