Skip to content

overtone-app/sqlite-wasm-esm

Repository files navigation

sqlite-wasm-esm

The new SQLite WASM build is rather hard to use in modern JS apps, so this wrapper package tries to make this easier.

Currently only tested with Vite. According to the

Usage

yarn add sqlite-wasm-esm
// your-worker.js
import sqlite3InitModule from "sqlite-wasm-esm";

sqlite3InitModule().then((sqlite3) => {
  const opfsDb = new sqlite3.opfs.OpfsDb("my-db", "c");
  // or in-memory ...
  const db = new sqlite3.DB();
});

Vite config

{
	// ...
	build: { target: ['es2020'], }, // Needed in `sqlite-wasm-esm` for big-ints to work
	optimizeDeps: {
		exclude: ['sqlite-wasm-esm'], // TODO remove once fixed https://github.com/vitejs/vite/issues/8427
    esbuildOptions: { target: 'es2020' }, // Needed in `sqlite-wasm-esm` for big-ints to work
	},
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages