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

How to use with vite?

Open cugarteblair opened this issue 8 months ago • 4 comments

I would like to use parquet-wasm in my vite project but have been unable to initialize. Here is how I am trying to initialize, also I added the vite-plugin-wasm in my vite.config.ts. I get this error(Note I get the same thing with the await pattern):

Error initializing WebAssembly module: TypeError: WebAssembly.instantiate(): Import #0 "./parquet_wasm_bg.js": module is not an object or function

// Here is how I try to initialize

import wasmInit, { readParquet } from "parquet-wasm";

// Provide the correct URL for the WebAssembly file const wasmUrl = new URL('../../node_modules/parquet-wasm/bundler/parquet_wasm_bg.wasm', import.meta.url).href;

// Initialize the WebAssembly module with the provided URL wasmInit(wasmUrl).then(() => { console.log("WebAssembly module initialized successfully"); }).catch((error) => { console.error("Error initializing WebAssembly module:", error); });

cugarteblair avatar Jun 07 '24 20:06 cugarteblair