How do I use SQL.js in a React app?
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 13.7k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello,
I am trying to use SQL.js within an existing React app.
I tried using the sql-js NPM package and loading SQL.js like so:
import initSqlJs from "sql.js";
await initSqlJs({
locateFile: (file) => `https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.6.2/${file}` // this was in an async function
});
and got this error at runtime:
./node_modules/sql.js/dist/sql-wasm.js:94:15
Module not found: Can't resolve 'fs'
I saw the demo repository but can't make heads or tails of it!
Any help would be greatly appreciated.
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.
Direzione di ricerca
Start by reproducing the reported initialization in an existing React app using the sql.js package and the locateFile configuration shown. Read the referenced demo repository alongside the runtime error in node_modules/sql.js/dist/sql-wasm.js; the issue is resolved when the app initializes SQL.js without the module-resolution failure.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react, sqlite, wasm
- Ambito
- database, frontend, web-dev
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100