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

Add option to run wasm-opt when building for the web #196

Closed
TimJentzsch opened this issue Dec 23, 2024 · 5 comments · Fixed by #206
Closed

Add option to run wasm-opt when building for the web #196

TimJentzsch opened this issue Dec 23, 2024 · 5 comments · Fixed by #206
Assignees
Labels
A-Build Related to the bevy build command A-Run Related to the bevy run command A-Web Building or running Bevy apps targeting the browser C-Feature Make something new possible

Comments

@TimJentzsch
Copy link
Collaborator

TimJentzsch commented Dec 23, 2024

For release web builds, it's useful to run wasm-opt on the WASM binary to optimize it further.
We should provide an option to do this automatically with little configuration.
The CLI should also ask to install wasm-opt for you automatically, if you don't have it yet.

Needed for TheBevyFlock/bevy_new_2d#312.

@TimJentzsch TimJentzsch added A-Run Related to the bevy run command A-Build Related to the bevy build command A-Web Building or running Bevy apps targeting the browser C-Feature Make something new possible labels Dec 23, 2024
@TimJentzsch
Copy link
Collaborator Author

wasm-opt can also be used as dependency, so we can skip the installation and just use the API directly

@BD103
Copy link
Member

BD103 commented Dec 26, 2024

Would a feature flag work best in this scenario (enabled by default, since that seems highly desired)?

@TimJentzsch
Copy link
Collaborator Author

Would a feature flag work best in this scenario (enabled by default, since that seems highly desired)?

Do you think it's enough to put this behind the web feature flag (#198)?

@BD103
Copy link
Member

BD103 commented Dec 26, 2024

Would a feature flag work best in this scenario (enabled by default, since that seems highly desired)?

Do you think it's enough to put this behind the web feature flag (#198)?

Maybe! We should use cargo build --timings to see how much it increases the build time. If it's not significant, then we can definitely group it under web. :)

@TimJentzsch
Copy link
Collaborator Author

TimJentzsch commented Dec 26, 2024

Well....

wasm-opt-sys compile time exploding

On second thought, let's put it behind a separate feature flag :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Build Related to the bevy build command A-Run Related to the bevy run command A-Web Building or running Bevy apps targeting the browser C-Feature Make something new possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants