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 sqlite3InitModule from '@sqlite.org/sqlite-wasm';
|
||||||
|
import wasmUrl from '@sqlite.org/sqlite-wasm/sqlite3.wasm?url';
|
||||||
import { getWebDAVBaseUrl, basename, listDirectory, putFileContents, deletePath } from './webdav';
|
import { getWebDAVBaseUrl, basename, listDirectory, putFileContents, deletePath } from './webdav';
|
||||||
|
|
||||||
const LOCATE_PATH = '/sd/.locate';
|
const LOCATE_PATH = '/sd/.locate';
|
||||||
// Resolved against import.meta.url so it works under any Vite base path
|
// Vite rewrites this `?url` import to the hashed asset path
|
||||||
// (/, /config/, etc.) the same way the sqlite-wasm library resolves it.
|
// (e.g. /assets/sqlite3-BVKGSWc-.wasm) and respects the configured base path.
|
||||||
const WASM_URL = new URL('sqlite3.wasm', import.meta.url).toString();
|
const WASM_URL: string = wasmUrl;
|
||||||
|
|
||||||
function parseContentLength(header: string | null): number | null {
|
function parseContentLength(header: string | null): number | null {
|
||||||
if (!header) return null;
|
if (!header) return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user