Error when installed from NPM and used with a React App
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 13.7k
- Forks
- 1.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Installing the library from NPM and running it breaks with:
Uncaught (in promise) Error: CompileError: WebAssembly.compile(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0
at Object.Module.onAbort (sql-wasm.js:34)
at B (sql-wasm.js:3614)
at sql-wasm.js:1024
Here's the minimal code that consistently produces the error above:
import initSqlJs from 'sql.js';
initSqlJs().then(function(SQL){
// Create a database
var db = new SQL.Database();
});
And here's a CodeSandbox that demonstrates the problem.
Using the code from the CDN works fine but it exposes a global window.SQL which is harder to mock during testing (among other things) so I'd prefer using the NPM library.
Do you have any pointers on what this magic number business is?
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Start with the npm-built sql-wasm.js referenced in the stack trace and compare its loading behavior with the working CDN version. Reproduce the minimal initSqlJs example in the linked CodeSandbox or a React app; done means the npm package loads valid WebAssembly and creates a SQL.Database without the compile error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, wasm
- Domaine
- database, web-dev
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 30/100