build: evita instalar dependencias opcionales y usa bun:sqlite

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
webui
borja 2 weeks ago
parent 3a5b212271
commit a9facabe07

@ -18,8 +18,7 @@ RUN bun install
COPY apps/web/package.json apps/web/ COPY apps/web/package.json apps/web/
WORKDIR /app/apps/web WORKDIR /app/apps/web
# No instalar optionalDependencies (better-sqlite3) en build de producción # No instalar optionalDependencies (better-sqlite3) en build de producción
ENV npm_config_optional=false RUN bun install --no-optional
RUN bun install
# Copy sources # Copy sources
WORKDIR /app WORKDIR /app

@ -28,15 +28,9 @@ function applyDefaultPragmas(instance: any): void {
* - En Node (Vite dev SSR): better-sqlite3 * - En Node (Vite dev SSR): better-sqlite3
*/ */
async function importSqliteDatabase(): Promise<any> { async function importSqliteDatabase(): Promise<any> {
try { // En desarrollo, el alias de Vite resolverá 'bun:sqlite' -> 'better-sqlite3'
// @ts-ignore const mod: any = await import('bun:sqlite');
if (typeof Bun !== 'undefined') { return (mod as any).Database || (mod as any).default || mod;
const mod = await import('bun:sqlite');
return (mod as any).Database;
}
} catch {}
const mod = await import('better-sqlite3');
return (mod as any).default || (mod as any).Database || mod;
} }
/** /**

Loading…
Cancel
Save