Can't import sql-wasm.wasm
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react, sqlite, wasm
Direzione di ricerca
Start with the linked react-sqljs-demo, then inspect src/App.js and the referenced craco.config.js around the sql.js/dist/sql-wasm.wasm import and initSqlJs call. Reproduce the loader and useEffect errors with the reported React version. Done means an existing SQLite database can be loaded and queried offline in the React app without the reported import or WASM errors.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I want to make sqlite db and browser work together offline in reactJS. I am using "react": "^17.0.2",
It seems there is a sqljs, sql-js and sql.js existing at the same time. Why do you use - in the name? To confuse?

I dare to install new version of it and used this demo
https://github.com/sql-js/react-sqljs-demo
And it complains on import string
import sqlWasm from "!!file-loader?name=sql-wasm-[contenthash].wasm!sql.js/dist/sql-wasm.wasm";
src/App.js
Line 6:1: Unexpected '!' in '!!file-loader?name=sql-wasm-[contenthash].wasm!sql.js/dist/sql-wasm.wasm'. Do not use import syntax to configure webpack loaders import/no-webpack-loader-syntax
After I delete !! in it it complains on
useEffect(async () => {
// sql.js needs to fetch its wasm file, so we cannot immediately instantiate the database
// without any configuration, initSqlJs will fetch the wasm files directly from the same path as the js
// see ../craco.config.js
try {
const SQL = await initSqlJs({ locateFile: () => sqlWasm });
setDb(new SQL.Database());
} catch (err) {
setError(err);
}
}, []);
put async inside useEffect. I just want to extract some data from SQLite DB offline
Maybe you could provide code to work with existing DB on localhost offline with use of react ?
P.S.
another approach doesn't work for me either even I put wasm file in the root folder


- Lingua principale
- JavaScript
- Stelle
- 13.7k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sql-js/sql.js
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Add the WebWorker API docs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di sql-js/sql.js
Issue simili
-
code-quality refactoring
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100