-
Notifications
You must be signed in to change notification settings - Fork 11
build: Add js
Cargo feature flag for WASM builds
#48
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?
build: Add js
Cargo feature flag for WASM builds
#48
Conversation
Previously, the wasm32 target implicitly assumed a browser environment, which caused issues when building for non-browser WASM environments due to the unconditional inclusion of `wasm-bindgen`. This commit introduces an explicit 'js' feature flag, making `wasm-bindgen` and `js-sys` conditional dependencies. This allows greater flexibility for different WASM execution environments. Related to solana-program#47
js
Cargo feature flag for WASM builds
@joncinque This is essentially the same as the PR in the |
This one should be easier to merge since it only affects the interface crate in this repo. I think we should move @LucasSte what do you think? |
@joncinque Thanks for looking into this! If it is confirmed that adding a new |
If you have the time, please go for it! |
Yes, that would be cool. I noticed that in this repo we also mix crate types (cdylib and rlib) for the same crate. I haven't checked why we need both yet, but I wanted them not be used together (it hinders LTO). |
Agreed, we definitely need to change that too |
@joncinque @LucasSte I took a stab at doing something similar here as in the |
Previously, the
wasm32
target implicitly assumed a browser environment, which caused issues when building for non-browser WASM environments due to the unconditional inclusion ofwasm-bindgen
.This commit introduces an explicit 'js' feature flag, making
wasm-bindgen
andjs-sys
conditional dependencies. This allows greater flexibility for different WASM execution environments.Related to #47