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

Large .wasm file size with Rust #3235

Closed
adenflorian opened this issue Jul 14, 2019 · 2 comments
Closed

Large .wasm file size with Rust #3235

adenflorian opened this issue Jul 14, 2019 · 2 comments

Comments

@adenflorian
Copy link

πŸ› bug report

When importing a .rs file from a .js file, and building the js file with parcel build index.js, the resulting wasm file is much larger than expected.

dist\lib.c67b7947.wasm    β€Ό  1.4 MB    22ms
dist\index.js.map            5.9 KB     5ms
dist\index.js               3.11 KB    39ms

πŸ€” Expected Behavior

I would expect the wasm file to be closer to 200 KB or less.

😯 Current Behavior

The wasm file is 1.4 MB.

πŸ’» Code Sample

https://github.com/AdenFlorian/parcel-rust-size-test

🌍 Your Environment

Software Version(s)
Parcel 1.12.3
Node 10.15.1
npm/Yarn yarn 1.17.3
Operating System Windows 10
@stale
Copy link

stale bot commented Jan 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Inactive issues label Jan 17, 2020
@agusbena
Copy link

You can add these to your he Cargo.toml:

[profile.release]
lto = true
opt-level = 's'

And it will go, in my case, from 1.7Mb to 189Kb
Note it is for release profile, it will take effect when you do:

parcel build [your_entry_point_file.ext]

@github-actions github-actions bot removed the Stale Inactive issues label Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants