Can't import sql-wasm.wasm
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 13.7k
- フォーク
- 1.1k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I want to make sqlite db and browser work together offline in reactJS. I am using "react": "^17.0.2",
It seems there is a sqljs, sql-js and sql.js existing at the same time. Why do you use - in the name? To confuse?

I dare to install new version of it and used this demo
https://github.com/sql-js/react-sqljs-demo
And it complains on import string
import sqlWasm from "!!file-loader?name=sql-wasm-[contenthash].wasm!sql.js/dist/sql-wasm.wasm";
src/App.js
Line 6:1: Unexpected '!' in '!!file-loader?name=sql-wasm-[contenthash].wasm!sql.js/dist/sql-wasm.wasm'. Do not use import syntax to configure webpack loaders import/no-webpack-loader-syntax
After I delete !! in it it complains on
useEffect(async () => {
// sql.js needs to fetch its wasm file, so we cannot immediately instantiate the database
// without any configuration, initSqlJs will fetch the wasm files directly from the same path as the js
// see ../craco.config.js
try {
const SQL = await initSqlJs({ locateFile: () => sqlWasm });
setDb(new SQL.Database());
} catch (err) {
setError(err);
}
}, []);
put async inside useEffect. I just want to extract some data from SQLite DB offline
Maybe you could provide code to work with existing DB on localhost offline with use of react ?
P.S.
another approach doesn't work for me either even I put wasm file in the root folder


コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Start with the linked react-sqljs-demo, then inspect src/App.js and the referenced craco.config.js around the sql.js/dist/sql-wasm.wasm import and initSqlJs call. Reproduce the loader and useEffect errors with the reported React version. Done means an existing SQLite database can be loaded and queried offline in the React app without the reported import or WASM errors.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react, sqlite, wasm
- 領域
- databases, frontend, web-dev
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100