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/
WORKDIR /app/apps/web
# No instalar optionalDependencies (better-sqlite3) en build de producción
ENV npm_config_optional=false
RUN bun install
RUN bun install --no-optional
# Copy sources
WORKDIR /app

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

Loading…
Cancel
Save