-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hi, I am seeing errors when I try to import parquet-wasm using the bundler esbuild.
Similar to this issue, #486, I am seeing this error
94924d21-558e-468e-97d6-52e78f9ca56d:1552 Error loading data: TypeError: Cannot read properties of undefined (reading '__wbindgen_add_to_stack_pointer')
at TP (94924d21-558e-468e-97d6-52e78f9ca56d:1552:48578)
at c (94924d21-558e-468e-97d6-52e78f9ca56d:1552:50503)
at b (94924d21-558e-468e-97d6-52e78f9ca56d:1552:52078)
at async Object.DV [as render] (94924d21-558e-468e-97d6-52e78f9ca56d:1559:1493)
at async widget.js:363:17
when I import parquet-wasm like this
import * as pq from "parquet-wasm/esm/arrow2";
without awaiting the default function. However, when I run await pq.default(), I see this error
widget.js:237 TypeError: Failed to construct 'URL': Invalid URL
at UP (542aeba4-c71d-47a1-8e67-2dcff8e6ca23:1553:14046)
at Object.oz [as render] (542aeba4-c71d-47a1-8e67-2dcff8e6ca23:1560:1458)
at async widget.js:363:17
If I try to switch to using the bundler build like this
import * as pq from "parquet-wasm/bundler/arrow2"
(which required using the wasmLoader for esbuild and setting the target for esnext to enable top-level await) I get this error
widget.js:237 TypeError: Failed to construct 'URL': Invalid URL
at LC (8a312991-81c6-426e-b14c-067bcbe5f62b:1553:10554)
at 8a312991-81c6-426e-b14c-067bcbe5f62b:1553:10908
and clicking LC (8a312991-81c6-426e-b14c-067bcbe5f62b:1553:10554) shows
async function LC(j, A) {
if (typeof j == "string") {
j.startsWith("./") && (j = new URL(j,import.meta.url).href);
let t = await fetch(j);
if (typeof WebAssembly.instantiateStreaming == "function")
try {
return await WebAssembly.instantiateStreaming(t, A)
} catch (e) {
if (t.headers.get("Content-Type") != "application/wasm")
console.warn(e);
else
throw e
}
j = await t.arrayBuffer()
}
return await WebAssembly.instantiate(j, A)
}
For some background, I'm using parquet-wasm in an anywidget that is being bundled with esbuild on the suggestion from this discussion. Also, the await pq.default() function works properly if use a CDN to obtain parquet-wasm like this
import * as pq from "https://unpkg.com/parquet-wasm@0.4.0-beta.5/esm/arrow2.js";