Using sql.js with next js fails #309
Comments
|
This initialization function takes a configuration argument that should explain where to find the wasm file: initSqlJs({
locateFile: filename => `/path/to/your/assets/${filename}`
}).then(...)And the wasm file from the sql.js release assets should be accessible at |
|
Hey, thanks for your reply! I tried initializing with specifying I've also tried bundling the |
|
@martonlanga I noticed in your first screen shot, you had a warning about unsupported MIME type. I had to add "application/wasm" to my iis server in order for the .wasm file to be served correctly! |
|
@LeeRob97 Yes, that was an issue but I've already added it since then. |
|
I created a demonstration showing the usage of sql.js with an asset packer, that may be useful to people who end up here after a google search: https://github.com/sql-js/react-sqljs-demo |


Bug report
Describe the bug
Trying to use
sql.jsin a nextjs project throws an error, while trying to initialize the module.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npx create-next-app next-sql.jscd next-sql.js/npm i sql.jspages/index.js:npm run devExpected behavior
Ability to import and use sql.js like in the example provided here.
Screenshots
Additional context
Also, without defining
fsinnext.config.js,sql-wasm.jsthrows a module not found error about thefsmodule.My guess is that I should change my config settings to support
wasm, but I'm not really familiar with that.Issue in next.js repo.
The text was updated successfully, but these errors were encountered: