-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Hashless assets #4312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Hashless assets #4312
Conversation
Haven't looked at the code, but do you think it's possible to have |
No, there is a flag that controls if the hash is added, but it can't modify if the symbol is kept. |
Another API we could support is this with the #[used]
static _EXTERNAL_ASSET: Asset = asset!(
"/66571940.jpeg",
ImageAssetOptions::new()
.into_asset_options()
.with_hash_suffix(false)
); |
From what I remember this might have issues with LTO since the static won't escape the module. Only |
It looks like that is a general caveat to the used attribute in the reference. Since we now do the asset intercept after the linker, the linker can modify/remove symbols. In practice, this doesn't seem to be the case on macos with the default linker. If you mark the asset symbol as used, it is kept even if it is private and unused in a library as long as that library is built.
I can reproduce this issue in the alpha, but not with the git version of the CLI + dioxus. It might have already been fixed? Building on web with this profile: [profile.release]
opt-level = "z"
debug = false
lto = true
codegen-units = 1
panic = "abort"
strip = true
incremental = false |
@ealmloff got some very bad news in this situation. Idk that it possible to force __LINK_SECTION static to persist in I cloned dioxus repo, in asset macro, I added I beat the various LLMs but they all telling me there isnt another way Here is my dioxus repo with the used n pub Here is the repo I am bundling I did fork dioxus-free-icons and bumped the dioxus version in it as I was using it in the site but thats the only dep that lso deps on dioxus
Did u use the --release flag with dx bundle? --release isnt default now for dx bundle .. without release works for me but also has the dev server trying to run .. with --release does not work for me even with latest git commit of dioxus |
You have https://github.com/Summit-Sailors/developer-portfolio/blob/main/Cargo.toml#L26 |
yes, I tried without strip and i tried without lto with strip = false
with lto=false it builds but issue persists with strip=false and lto=false
I tried a few other various combos and the doixosu toml wasm opt settings :/ |
This adds a new option to the
AssetOptions
struct to opt out of asset hashes. It also introduces a newexternal_asset!
macro which keeps the asset even if the asset link is unused in the rust code.Closes #4115