fix(locate-db): update WASM URL import to use Vite's hashed asset path
This commit is contained in:
parent
7f218f4225
commit
eb0357253c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user