The use of dioxus_desktop 0.5.0 bug
Problem
The use of dioxus_desktop bug
Steps To Reproduce
Steps to reproduce the behavior:
- Try to use dioxus_desktop 0.5.0 to replace dioxus 0.5.0 in making a desktop application but found multiple errors including webviews
- If use dioxus,everything is ok
Expected behavior
Use dioxus desktop to create desktop application successfully Screenshots
Environment:
- Dioxus version: 0.5.
- Rust version: rustc 1.82.0-nightly (a32d4a0e8 2024-08-21)
- OS info: Windows
- App platform: desktop
Questionnaire
- [x] I'm interested in fixing this myself but don't know where to start
- [ ] I would like to fix and I have a solution
- [ ] I don't have time to fix this right now, but maybe later
In the first error:
compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.");
Are you sure you compile for desktop? Can you please show your Cargo.toml file?
Here is the Cargo.toml file
If you want to compile for desktop, then you don't need to crate dioxus_desktop separately. You need to add the desktop flag to features in crate dioxus. In your case, there may be an error because you are using the web.
And maybe you don't need tokio in dev-dependencies or move to dependencies.
try this:
# ...
[dependencies]
dioxus = { version = "0.6", features = ["desktop", "router"]}
# ...
P.S.: Please copy the text of your error instead of adding screenshots.
If it was useful for you and solved your problem, please close this issues!
Huh based on your errors above it looks like dx serve is trying to compile your app for the web by default. If you're looking to compile for desktop, you have to either edit your Dioxus.toml file or run dx serve --platform desktop.
https://dioxuslabs.com/learn/0.5/CLI/configure
I will test the solution today, after solving the problem I will close the issue,thanks!
Dear [Be3y4uu-K0T] & matthunz : Problem solved!Thanks!