use vite v8 for faster builds
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user