sql-js / sql-js/sql.js

Error when installed from NPM and used with a React App

オープン
#282 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
13.7k
フォーク
1.1k
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, wasm
領域
database, web-dev
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。