Open xnuk opened 2 years ago
I'm using node@18.5.0 with ES modules and had to explicitly set a path to the wasm binary:
const wasmBinary = await readFile(new URL("../node_modules/sql.js/dist/sql-wasm.wasm", import.meta.url));
const SQLJS = await initSql({
wasmBinary,
});
Hope that helps!
@jmandzik I have failed to use the option you mentioned above. https://github.com/sql-js/sql.js/issues/522
The problem on my side is that the readFile
does not allow to take more than one arguments. Which readFile
module that you once import?
@sigridjineth
The problem on my side is that the
readFile
does not allow to take more than one arguments.
Read again carefully, there's two parameters in new URL(..., ...)
, not await readFile(...)
readFile
can have two parameters: 2nd parameter for file options.I am facing the same issue on an existing project where the only change I did was in node version to 20.
Seems like Node 18 issue now. https://github.com/netlify/cli/issues/4610.
With given package.json:
Here's the result of
node -e 'require("sql.js")()'
: