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

Suggest adding wasm32-unknown-unknown to cargo config on Linux #1796

Closed
ealmloff opened this issue Jan 8, 2024 Discussed in #947 · 4 comments
Closed

Suggest adding wasm32-unknown-unknown to cargo config on Linux #1796

ealmloff opened this issue Jan 8, 2024 Discussed in #947 · 4 comments
Labels
cli Related to the dioxus-cli program documentation Improvements or additions to documentation

Comments

@ealmloff
Copy link
Member

ealmloff commented Jan 8, 2024

Discussed in #947

Originally posted by pickfire April 9, 2023
I noticed if I did not specify wasm32-unknown-unknown and I use dioxus serve --hot-reload with rust-analyzer running in the terminal, it needs a full build every time and the incremental build is very slow.

But if I add the wasm target to cargo config in .cargo/config, then it became very fast even on non-rsx changes (from ~48s to ~2.5s). Maybe because there are some issues with caching for rust-analyzer?

[build]
target = "wasm32-unknown-unknown"

Maybe we can suggest adding that to https://dioxuslabs.com/docs/0.3/guide/en/getting_started/hot_reload.html if web is used?

This issue does not effect windows or mac, but there have been other reports of the same issue on discord about hot reloading doing a full rebuild on linux with rust analyzer

@ealmloff ealmloff added documentation Improvements or additions to documentation cli Related to the dioxus-cli program labels Jan 8, 2024
@ealmloff
Copy link
Member Author

ealmloff commented Jan 8, 2024

We should change rust-analyzer.cargo.target, not the default target for cargo so that we don't break cargo run for any cross platform apps

@jkelleyrtp jkelleyrtp added this to the High-Priority Backlog milestone Jul 25, 2024
@ealmloff
Copy link
Member Author

ealmloff commented Aug 2, 2024

We could try to insert it into the config in rust-lang/rust-analyzer#13529

@Craig-Macomber
Copy link

[build]
target = "wasm32-unknown-unknown"

I manually added that to my cargo config (it seemed the easiest way at the time I could get syntax highlighting for web specific stuff in vscode), and I noticed it breaks dx serve --platform desktop, giving "I/O Error: Exec format error (os error 8)" (I think because it compiled for wasm).

I think thats a bug in dx serve : it seems like if you explicitly select desktop, it probably shouldn't build wasm.

On the bright side, with the great changes in 0.5, I no longer have significant wasm specific code and use desktop for debugging, so I'm just going to remove that from my cargo.toml.

@jkelleyrtp
Copy link
Member

We switched to using profiles for our different targets to fix this issue in v0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants