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
Import __wbindgen_bigint_from_i64
with Non-JS-compatible Func Sigurature (i64 as parameter)
#3095
Comments
I assume this is a consequence of #3037? |
@alexcrichton This is a serious bug for us that breaks Big*Array uses in wasm-pack. We've had to pin back this release, I suggest this crate version be pulled until this is resolved. |
In case they're not following all the issues here, I'll ping @Liamolucko and @RReverser for their thoughts on this |
Hm, not sure what's going on - seems like we pack's wasm parser doesn't support bigint integration still? |
I assume it's a combination with #3037 that's causing the issue, since that PR changed the ABI under an assumption that all engines support bigint<>i64 integration (which they do, but Webpack might be a special case). |
Seems to be webpack/webpack#8531 which I guess never got resolved on the webpack side after being auto-closed? cc @xtuc |
In my example above, I'm using Webpack 4, specifically 4.46.0. In my case it's just a toy example and maybe upgrading to Webpack 5 would fix this? |
Sorry, I'm on my phone so it's just a stream of thought as I'm trying to find relevant stuff. webpack/webpack#8531 (comment) sounds like async Wasm integration should be fine, but the deprecated sync one still has a problem. I'm not sure which one is used by wasm-pack here? |
Oh yeah worth trying. |
Given that 4.46.0 is 2 years old (according to https://www.npmjs.com/package/webpack/v/4.46.0), that seems very likely that the feature was implemented after that. 2 years is a lot in Wasm land. |
I agree that it's a long time, so it may be that supporting Webpack 4 is no longer desired. Dropping support for Webpack 4 in a patch release seems like a big change and I just would've rather seen it as part of an 0.3 release. (Though given that the patch version is now in the 80s, maybe wasm-bindgen just doesn't use semver). |
Yeah I can agree with that, #3037 in general was probably a breaking change. I believe wasm-bindgen does follow semver and tries to avoid breaking issues until 0.3 at some point in the future. |
I think the sync version is just a compat mode for how wasm worked in webpack 4; so, webpack 4 has the same problem. I think support could be added on Webpack's end by adding I haven't had a chance to actually test that, though. It's the same in webpack 4: |
… mode (Note: this fix is mainly meant for being backported to webpack 4, since `syncWebAssembly` is deprecated anyway, but I've implemented it against webpack 5 first.) It's now supported in all major browsers, and is represented by `bigint` in JS. There was an existing test that used `i64` as an example of a non-JS-compatible type; I replaced that with `v128`. Ref rustwasm/wasm-bindgen#3095
Running into challenges. The Rust part compiles, but when building with Webpack, I get this error: ``` ERROR in ./pkg/index_bg.wasm Import "__wbindgen_bigint_from_u64" from "./index_bg.js" with Non-JS-compatible Func Sigurature (i64 as parameter) can only be used for direct wasm to wasm dependencies @ ./pkg/index.js @ ./js/index.js ℹ 「wdm」: Failed to compile. ``` This issue (rustwasm/wasm-bindgen#3095) talks about the same problem. The fix (webpack/webpack#16339) was merged but not backported into Webpack 4, so I'm going to have to try and upgrade to fix.
Describe the Bug
After upgrading from
0.2.82
to0.2.83
I appear to have an issue using the generated code from webpack (with thebundler
target of wasm-pack).It looks like there were some bigint-related changes between 0.2.82 and 0.2.83 of
wasm-bindgen
. I had been returningi64
from some functions without issue before bumping to 0.2.83 so I think it's a change inwasm-bindgen
Steps to Reproduce
Specifically, the wasm-pack flags provided to the bundle that fails to load is
Using the previous version of
wasm-bindgen
generated a_bg.js
file where the only grep ofbigint
was:Now there's a new function that triggers this webpack error:
Expected Behavior
Able to run application through webpack
Additional Context
The text was updated successfully, but these errors were encountered: