use vite v8 for faster builds

This commit is contained in:
2026-03-13 13:12:44 +01:00
parent be19e26d1b
commit cf1519acc6
4 changed files with 206 additions and 158 deletions

View File

@@ -1,11 +1,12 @@
import * as schema from './schema';
import { building } from '$app/environment';
import { drizzle } from 'drizzle-orm/bun-sql';
import { env } from '$env/dynamic/private';
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
if (!process.versions.bun) {
throw new Error('Bun SQL requires the Bun runtime. If in a dev environment, try running the app with `bun --bun vite dev`.');
function createDb() {
if (building) return null!;
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
return drizzle(env.DATABASE_URL, { schema });
}
const { drizzle } = await import('drizzle-orm/bun-sql');
export const db = drizzle(env.DATABASE_URL, { schema });
export const db = createDb();