-
Notifications
You must be signed in to change notification settings - Fork 11
Target architecture wasm32
should not assume a Javascript environment
#47
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
Comments
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
Follow-up on #57: As a temporary solution until solana-program/system#47 is merged upstream, use the fix from solana-program/system@382138c on the fork [dfinity/solana-system-program](https://github.com/dfinity/solana-system-program).
Hey @lpahlavi sorry for the delay here. The linked article also mentions that non-browser environments could be JavaScript, so we don't want a feature for non-JS, but rather a feature for non-browser. In your linked PR, I'm wondering if the Also, what does the presence of |
Hi @buffalojoec, thanks a lot for having a look at this! No worries about the delay, I was myself on holidays for the last 2 weeks hence the delay on my side.
I don't have a particularly strong opinion about this, and could be convinced to change it, but I used
It seems to me that the problem is that WASM code where |
Problem
When the
solana-system-interface
crate is compiled towasm32
, the dependencywasm-bindgen
is included.For example here:
The wasm-bindgen crate only makes sense if the compiled wasm is to be used in a Javascript environment (typically a browser); however, there are many other use cases for compiling to wasm and running the compiled wasm outside a web environment. Currently this fails due to the presence of wasm-bindgen.
Proposal
Only pull the wasm-bindgen crate when a feature flag indicating a Javascript environment is present.
See #48 and a similar issue in the
solana-sdk
repository here.The text was updated successfully, but these errors were encountered: