diff --git a/src/app/locate-db.ts b/src/app/locate-db.ts index 0957186..5dadd5a 100644 --- a/src/app/locate-db.ts +++ b/src/app/locate-db.ts @@ -1,10 +1,11 @@ import sqlite3InitModule from '@sqlite.org/sqlite-wasm'; +import wasmUrl from '@sqlite.org/sqlite-wasm/sqlite3.wasm?url'; import { getWebDAVBaseUrl, basename, listDirectory, putFileContents, deletePath } from './webdav'; const LOCATE_PATH = '/sd/.locate'; -// Resolved against import.meta.url so it works under any Vite base path -// (/, /config/, etc.) the same way the sqlite-wasm library resolves it. -const WASM_URL = new URL('sqlite3.wasm', import.meta.url).toString(); +// Vite rewrites this `?url` import to the hashed asset path +// (e.g. /assets/sqlite3-BVKGSWc-.wasm) and respects the configured base path. +const WASM_URL: string = wasmUrl; function parseContentLength(header: string | null): number | null { if (!header) return null;