mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
sqlite.worker.js implements the SQLDelight web-worker protocol
(exec/begin_transaction/end_transaction/rollback_transaction) on top
of @sqlite.org/sqlite-wasm. Prefers the OPFS SAH pool VFS for
persistent storage and falls back to in-memory when OPFS is
unavailable.
webpack.config.d/coopcoep.js sends COOP/COEP headers on the dev
server so cross-origin isolation is available, even though the SAH
pool itself does not require it. webpack.config.d/sqlite-wasm.js
enables asyncWebAssembly so webpack can bundle sqlite3.wasm via the
'new URL("sqlite3.wasm", import.meta.url)' reference inside the
sqlite-wasm package.
10 lines
473 B
JavaScript
10 lines
473 B
JavaScript
// Webpack picks up `new Worker(new URL("./sqlite.worker.js", import.meta.url),
|
|
// { type: "module" })` from the compiled Kotlin/wasm output and bundles the
|
|
// worker. The bundled worker imports `@sqlite.org/sqlite-wasm`, which in turn
|
|
// loads sqlite3.wasm via `new URL("sqlite3.wasm", import.meta.url)`. Enabling
|
|
// asyncWebAssembly lets webpack process that .wasm reference correctly.
|
|
config.experiments = {
|
|
...(config.experiments || {}),
|
|
asyncWebAssembly: true,
|
|
};
|