diff --git a/src/db/db-worker.ts b/src/db/db-worker.ts new file mode 100644 index 0000000..4a01034 --- /dev/null +++ b/src/db/db-worker.ts @@ -0,0 +1,4 @@ +// we could use the worker file from ./lib/kysely-official-wasm-worker/worker/index.ts, but somehow that doesn't get bundled correctly +import { createOnMessageCallback } from "~/lib/kysely-official-wasm-worker"; + +self.onmessage = createOnMessageCallback(); diff --git a/src/db/db.ts b/src/db/db.ts index 2cd2082..584b868 100644 --- a/src/db/db.ts +++ b/src/db/db.ts @@ -1,16 +1,14 @@ import { Kysely } from "kysely"; import type { DB } from "./db-schema"; import { OfficialWasmWorkerDialect } from "~/lib/kysely-official-wasm-worker"; -import wasmWorkerUrl from "~/lib/kysely-official-wasm-worker/worker?url"; +import WasmWorker from "./db-worker?worker"; import { createSignal } from "solid-js"; export const SELF_ID = 2; export const DB_FILENAME = "signal.sqlite"; -export const worker = new Worker(wasmWorkerUrl, { - type: "module", -}); +export const worker = new WasmWorker(); const dialect = new OfficialWasmWorkerDialect({ fileName: DB_FILENAME,