Skip to content

Conversation

mohe2015
Copy link
Contributor

When combining multiple dioxus runs (for example web worker output with web application) it is helpful when the subdirectories are also honored for hashless assets so that the wasm imports from the wasm/ folder of the web worker is correctly found.

I don't know if this is the best solution but maybe you have a better idea. Also at some places the correct relative path is not calculated.

@mohe2015 mohe2015 requested a review from a team as a code owner September 26, 2025 14:20
PathBuf::from(format!("{}-dxh{hash}", file_stem.to_string_lossy()))
} else {
PathBuf::from(file_stem)
PathBuf::from(asset.relative_source_path().trim_start_matches("/assets/")).with_extension("")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main functional change

@ealmloff
Copy link
Member

This design could have some odd behavior for relative assets. If I include asset!("../../asset.png") (which should be valid if you don't publish your app on crates.io), it shouldn't be copied outside of the asset directory.

You can control where assets are copied today by copying a folder into the asset dir, but it is more work to set up if you need to copy it into a deeply nested folder.

// / wasm
//   / myapp.wasm  
asset!("/wasm").with_hash(false); // this will copy the wasm folder and all of its contents into the asset folder

What do you think about a separate destination path option on the asset builder like this instead?

asset!("../../asset.png").with_bundled_at("/my/wasm/folder/asset.png")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants