dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

The use of dioxus_desktop 0.5.0 bug

Open 1195655796 opened this issue 1 year ago • 4 comments

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

3c827486776801e5cbf25645719d24a e0177ec3964460bf48319f856e4ce97 98b144f57284ea186ab104dadce5035 f00a0ee3188cd73c1590430cb94049b

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

1195655796 avatar Aug 28 '24 02:08 1195655796

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?

Be3y4uu-K0T avatar Aug 28 '24 09:08 Be3y4uu-K0T

Here is the Cargo.toml file 486a575b598337f956c2bc29e2b7ae3 81be44e698e11a9d73a55f0bd9cf573

1195655796 avatar Aug 28 '24 09:08 1195655796

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.

Be3y4uu-K0T avatar Aug 28 '24 09:08 Be3y4uu-K0T

If it was useful for you and solved your problem, please close this issues!

Be3y4uu-K0T avatar Aug 28 '24 13:08 Be3y4uu-K0T

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

matthunz avatar Aug 28 '24 21:08 matthunz

I will test the solution today, after solving the problem I will close the issue,thanks!

1195655796 avatar Aug 29 '24 00:08 1195655796

Dear [Be3y4uu-K0T] & matthunz : Problem solved!Thanks!

1195655796 avatar Aug 29 '24 01:08 1195655796