-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
bugSomething isn't workingSomething isn't workingcliRelated to the dioxus-cli programRelated to the dioxus-cli program
Description
Problem
Hi, bundling with swc_bundler as is the default for production leads to import.meta.url
referencing absolute file paths in production which breaks importing based on them. swc-project/swc#7511 seems to have requested to allow disabling this but there was never a response. I couldn't find a workaround.
Steps To Reproduce
Steps to reproduce the behavior:
Dioxus app with:
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen]
extern "C" {
// Getters can only be declared on classes, so we need a fake type to declare it on.
#[wasm_bindgen]
type meta;
#[wasm_bindgen(js_namespace = import, static_method_of = meta, getter)]
fn url() -> String;
}
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn shim_url() -> String {
meta::url()
}
info!("{}", shim_url());
- Build with
--release
Expected behavior
import.meta.url
should return a correct value.
Screenshots
Environment:
- Dioxus version:
main
- Rust version: nightly
- OS info: NixOS 25.05
- App platform: web
Questionnaire
I'm interested in fixing this myself but don't know where to start.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcliRelated to the dioxus-cli programRelated to the dioxus-cli program