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

Optimize wasm bindgen asset with manganis #3531

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ealmloff
Copy link
Member

@ealmloff ealmloff commented Jan 9, 2025

This PR uses the manganis bundling system to hash and optimize the assets wasm bindgen generates. It also expands cli-opt to support bundling multiple js files together which is useful for the javascript files wasm bindgen outputs.

Requests for hello world app with old version of DX:
Screenshot 2025-01-09 at 1 13 12 PM

Requests for hello world app with new version of DX:
Screenshot 2025-01-09 at 1 13 29 PM

Closes #3350
Closes #3339
Closes #3278
Closes #3277
Closes #2124

@ealmloff ealmloff marked this pull request as ready for review January 9, 2025 20:27
@ealmloff ealmloff added bug Something isn't working cli Related to the dioxus-cli program performance fullstack related to the fullstack crate labels Jan 9, 2025
@@ -7,7 +7,7 @@ description = "CLI for building fullstack web, desktop, and mobile apps with a s
repository = "https://github.com/DioxusLabs/dioxus/"
license = "MIT OR Apache-2.0"
keywords = ["mobile", "gui", "cli", "dioxus", "wasm"]
rust-version = "1.79.0"
rust-version = "1.81.0"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc requires a newer version of rust to build. I'm not sure how much we care about the rust version the CLI requires since we are leaning into binstall everywhere, but if this an issue I could look for alternatives

@ealmloff ealmloff changed the title Optimize initial assets Optimize wasm bindgen asset with manganis Jan 9, 2025
@ealmloff
Copy link
Member Author

Marking this as a draft until we find the latest version of swc settings that are compatible with a broader set of javascript like #3539

@ealmloff ealmloff marked this pull request as draft January 13, 2025 18:53
@ealmloff ealmloff marked this pull request as ready for review January 14, 2025 16:10
@ealmloff
Copy link
Member Author

This PR also fixes a few caching issues with manganis/the CLI:

  • If you interrupt the CLI while it is optimizing a large folder and then restart it. The CLI would think the optimization was finished and use the partially finished folder
  • If you upgrade the CLI and run it on an old project, the assets would not be re-optimized. That means any new CLI releases that fix optimization issues would not be applied until the target directory is cleared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the dioxus-cli program fullstack related to the fullstack crate performance
Projects
None yet
1 participant