How to use in Vite?
mtdvlpr opened this issue · comments
Manoah Tervoort commented
I am using Nuxt3 with Vite. I have the following code:
import wasmUrl from '@/public/sql-wasm.wasm?url'
const { default: sqljs } = await import('sql.js')
const SQL = await sqljs({
locateFile: () => wasmUrl,
})
I get the following error:
TypeError: Cannot set properties of undefined (setting 'exports')
at sql-wasm.js:95:451
When I use the below config I get the error that sqljs
is undefined and therefore not a function.
vite: {
build: {
rollupOptions: {
external: [/node_modules\/sql\.js\/dist\/sql-wasm\.js$/],
},
},
},
Am I missing something?
Ophir LOJKINE commented
This is more a question than an issue, I'm closing it, but feel free to discuss below.
4www commented
Adding for ref, answered here.