How do I use SQL.js in a React app?
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 13.7k
- Forks
- 1.1k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, react, sqlite, wasm
- Área
- database, frontend, web-dev
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 20/100