dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Counter example fails to load js when the project name is non-ascii

Open 1984204066 opened this issue 2 months ago • 4 comments

Problem

I don't know if it is caused by my Linux environment, because it is very simple case, I totally copy demo from guide doc. but click on buttons has no effect. While back to dioxus 0.6.3 + dioxus-cli 0.7.2 can work. (dioxus0.7.0 may also work)

here is the code `// main.rs #[cfg(test)] mod tests; mod components;

use components::; use purple_star::; // use libs::; use once_cell::sync::OnceCell; use std::collections::HashMap; use std::sync::{Arc, RwLock}; use dioxus::prelude::;

// const CSS: Asset = asset!("/assets/main-d2ee087f.css"); const CSS: Asset = asset!("/assets/main.css");

fn main() { println!("Hello, world!"); // Init logger // dioxus::logger::init(Level::INFO).expect("failed to init logger"); dioxus::launch(Demo); }

#[component] fn Demo() -> Element { let mut count = use_signal(|| 0);

rsx! {
    h1 { "High-Five counter: {count}" }
    button { onclick: move |_| count += 1, "Up high!" }
    button { onclick: move |_| count -= 1, "Down low!" }
}

} this is cargo.toml[package] name = "紫微斗数" version = "0.1.0" edition = "2024"

[lib] name = "purple_star"

[dependencies] num_enum = "0.7.4" once_cell = "1.21.3" paste = "1.0.15" strum = { version = "0.27.2", features = ["derive"] } strum_macros = "0.27.2" dioxus = { version = "0.7.2", features = ["fullstack", "logger" , "router"] } serde_json = "1.0.145" wasm-bindgen = "0.2.106" web-sys = "0.3.83" serde = { version = "1.0.228", features = ["derive"] }

[features] default = ["desktop"] web = ["dioxus/web"] desktop = ["dioxus/desktop"] mobile = ["dioxus/mobile"]

[profile]

[profile.wasm-dev] inherits = "dev" opt-level = 1

[profile.server-dev] inherits = "dev"

[profile.android-dev] inherits = "dev" ` rustc --version rustc 1.94.0-nightly (ba2142a19 2025-12-07)

Steps To Reproduce dx serve --platform web

Steps to reproduce the behavior:

Expected behavior

Screenshots

Environment:

  • Dioxus version:
  • Rust version:
  • OS info:
  • App platform:

Questionnaire

1984204066 avatar Dec 14 '25 02:12 1984204066

Works for me, probably your environment. Things to try:

  • Stable rust
  • Verbose logging and read through
  • Ensure your dx version matches the dioxus version

If this does not work, provide a min reproducible example repo

mcmah309 avatar Dec 14 '25 04:12 mcmah309

Cannot reproduce.

1984204066 avatar Dec 15 '25 13:12 1984204066

the key pointer is to change name to non-english language in cargo.toml

Here is my procedure to reproduce this problem. I use newer rustc nightly version rustc 1.94.0-nightly dx --version dioxus 0.7.2 (was built without git repository)

fresh dx new counter copy the Counter Demo code, here is my main.rs

` use dioxus::prelude::*; const FAVICON: Asset = asset!("/assets/favicon.ico"); const MAIN_CSS: Asset = asset!("/assets/main.css"); const HEADER_SVG: Asset = asset!("/assets/header.svg");

fn main() { dioxus::launch(Demo); }

#[component] fn Demo() -> Element { let mut count = use_signal(|| 0);

rsx! { h1 { "High-Five counter: {count}" } button { onclick: move || count += 1, "Up high!" } button { onclick: move || count -= 1, "Down low!" } } }

  1. change to dioxus version to 0.7.2 in Cargo.toml, and compile. Every thing goes OK till now.

  2. change name Cargo.toml

` [package] name = "计数器" version = "0.1.0" authors = ["1984204066 [email protected]"] edition = "2021"

See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies] dioxus = { version = "0.7.2", features = ["fullstack"] }

[features] default = ["web"] web = ["dioxus/web"] desktop = ["dioxus/desktop"] mobile = ["dioxus/mobile"] server = ["dioxus/server"]

`

dx serve --platform web the counter now freezed. I'm not sure if this is 0.7.2's bug, but with previous version it seems OK. (while I am not verify it again) Hope you can reproduce this case.

0.7.1 also has this problem.

1984204066 avatar Dec 15 '25 23:12 1984204066

I can reproduce it with those instructions (https://github.com/ealmloff/reproduce-5093). It looks like there is something special about fullstack here as well since I can't reproduce this with a purely SPA setup. It might be a file path issue? It looks like the js script that starts the app isn't found

Image

ealmloff avatar Dec 16 '25 00:12 ealmloff