Skip to content

Commit 8dd6cdc

Browse files
committed
fix: hide bun:sqlite import from tsc on Node.js builds
Concatenate the module specifier at runtime ('bun:' + 'sqlite') so tsc doesn't try to resolve it during compilation on Node.js CI runners.
1 parent 6d399bc commit 8dd6cdc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/db.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ let _Database: any;
1212
let _sqliteVecLoad: (db: any) => void;
1313

1414
if (isBun) {
15-
_Database = (await import("bun:sqlite")).Database;
15+
// Dynamic string prevents tsc from resolving bun:sqlite on Node.js builds
16+
const bunSqlite = "bun:" + "sqlite";
17+
_Database = (await import(/* @vite-ignore */ bunSqlite)).Database;
1618
const { getLoadablePath } = await import("sqlite-vec");
1719
_sqliteVecLoad = (db: any) => db.loadExtension(getLoadablePath());
1820
} else {

0 commit comments

Comments
 (0)