How do I use SQL.js in a React app?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 13.7k
- Forks
- 1.1k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react, sqlite, wasm
- Bereich
- database, frontend, web-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100