Skip to content

How do I use SQL.js in a React app? #612

Description

@AutistiCoder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions