Error when installed from NPM and used with a React App
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 13.7k
- Fork
- 1.1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, wasm
- Lĩnh vực
- database, web-dev
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 30/100