Skip to content

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

Open
@AutistiCoder

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy