-
Notifications
You must be signed in to change notification settings - Fork 19
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
Example doesnt work #465
Comments
seems related to #412 |
Can you say what you tried? Usually an error like
means that you didn't initialize the Wasm bundle. If you're using the |
Tried to run it with node v21.5.0 in esm mode (with |
In esm mode, you always have to await the default export, or you'll get errors like above where the wasm wasn't instantiated |
@kylebarron Would you accept a PR that updates the documentation? I also ran into this exact issue when integrating parquet-wasm into an ESM web worker (next.js). I think this would be very helpful given that e.g. also vite defaults to esm modules with v5. |
Isn't esm async out-of-box? I always thought that the whole meaning of esm is the possibility to export somewhat asynchronous, yet I have to do |
Yes of course! PRs always welcome
It is but wasm initialization is a separate async step from just loading the code itself. Ideally we can fix #414 and then publish an 0.6 release sometime soon, but I haven't had time to test that. |
Well, can't wait for this to happen, as of now I had to use apache arrow + node-addon-api, to it would be nice to have a stable API for working with parquets. What we gonna do with this issue? |
well, can we just create an export in which we await this |
So we can just import the module and be ready to go. Because generally this |
No, as far as I can tell that's not possible. And even if it were, I'd have to somehow modify the default JS binding that wasm-bindgen emits, which sounds horrible.
How is this dubious? import initWasm, {readParquet} from 'parquet-wasm/esm/arrow1.js';
await initWasm();
readParquet(...); FWIW sql.js has the same behavior, which they call A PR is welcome to improve the docs! But otherwise I'm going to close this because it's expected behavior. |
what about doing like import initWasm, * as MyExports from 'parquet-wasm/esm/arrow1.js';
await initWasm();
export * from MyExports; |
what I mean is why not just create a wrapper around the default wasm-bindgen intricacies to make the usage more simple :) |
The wasm bundle is not fetched until the Additionally, you can pass a URL into |
Correct me if I'm wrong, but in this case one can just import the whole module asynchronously,i.e. await import(...). So you have this "power" even without the init step. But this step overcomplicates Node.js usage. |
This is just terrible |
If you're in node, use the node export |
I'm following the steps from README.md and getting this error
The text was updated successfully, but these errors were encountered: