parquet-wasm icon indicating copy to clipboard operation
parquet-wasm copied to clipboard

reading wbindgen issue with webpack

Open kbatchu opened this issue 1 year ago • 4 comments
trafficstars

I am getting an error message "Uncaught TypeError TypeError: Cannot read properties of undefined (reading '__wbindgen_add_to_stack_pointer') at readParquet (c:\PROJECTS\DataVizSandbox\DuckDBWasm\node_modules\parquet-wasm\esm\parquet_wasm.js:300:1).

I am using webpack 5.89.0. I get this same error message with both "parquet-wasm "^0.6.0-beta.2" and '"@geoarrow/geoparquet-wasm": "^0.2.0-beta.2".

Any idea on how to fix this?

Thanks

kbatchu avatar Apr 02 '24 18:04 kbatchu

esm\parquet_wasm

You should usually be using the bundler entry point with webpack.

Alternatively, if you're using the esm entry point, you need to await the default export. Your error is happening because you're not awaiting the wasm from the esm entry point.

I don't use webpack myself but there's an example template here: https://github.com/rustwasm/rust-webpack-template/blob/master/template/webpack.config.js

kylebarron avatar Apr 02 '24 19:04 kylebarron

I made the existing text in the README bold: https://github.com/kylebarron/parquet-wasm/pull/487

kylebarron avatar Apr 02 '24 19:04 kylebarron

I tried using - import * as Parquet from "parquet-wasm"; and Parquet.readParquet() but I am still getting the same error.

kbatchu avatar Apr 02 '24 22:04 kbatchu

You're probably getting the esm import by default. In that case, you need to do

await Parquet.default();
Parquet.readParquet()

kylebarron avatar Apr 03 '24 02:04 kylebarron

I think this issue is resolved, but feel free to comment again if not

kylebarron avatar Apr 19 '24 01:04 kylebarron