fix: db worker not working in build
This commit is contained in:
parent
fdf3c371d5
commit
448dde62f7
2 changed files with 6 additions and 4 deletions
4
src/db/db-worker.ts
Normal file
4
src/db/db-worker.ts
Normal file
|
@ -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();
|
|
@ -1,16 +1,14 @@
|
||||||
import { Kysely } from "kysely";
|
import { Kysely } from "kysely";
|
||||||
import type { DB } from "./db-schema";
|
import type { DB } from "./db-schema";
|
||||||
import { OfficialWasmWorkerDialect } from "~/lib/kysely-official-wasm-worker";
|
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";
|
import { createSignal } from "solid-js";
|
||||||
|
|
||||||
export const SELF_ID = 2;
|
export const SELF_ID = 2;
|
||||||
|
|
||||||
export const DB_FILENAME = "signal.sqlite";
|
export const DB_FILENAME = "signal.sqlite";
|
||||||
|
|
||||||
export const worker = new Worker(wasmWorkerUrl, {
|
export const worker = new WasmWorker();
|
||||||
type: "module",
|
|
||||||
});
|
|
||||||
|
|
||||||
const dialect = new OfficialWasmWorkerDialect({
|
const dialect = new OfficialWasmWorkerDialect({
|
||||||
fileName: DB_FILENAME,
|
fileName: DB_FILENAME,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue