forked from jsnbuchanan/crowd-funder-for-time-pwa
fix error loading WASM file
This commit is contained in:
@@ -4,7 +4,12 @@ import IndexedDBBackend from 'absurd-sql/dist/indexeddb-backend';
|
||||
|
||||
async function run() {
|
||||
console.log("----- initSqlJs");
|
||||
let SQL = await initSqlJs({ locateFile: file => file });
|
||||
let SQL = await initSqlJs({
|
||||
locateFile: file => {
|
||||
// In Vite, we need to use the full URL to the WASM file
|
||||
return new URL(`/node_modules/@jlongster/sql.js/dist/${file}`, import.meta.url).href;
|
||||
}
|
||||
});
|
||||
let sqlFS = new SQLiteFS(SQL.FS, new IndexedDBBackend());
|
||||
SQL.register_for_idb(sqlFS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user