fix(runtime): bundle all deps to avoid bun CJS loader crash
This commit is contained in:
@@ -3,6 +3,16 @@ import type { Handle, HandleServerError } from '@sveltejs/kit';
|
||||
import { sequence } from '@sveltejs/kit/hooks';
|
||||
import { building } from '$app/environment';
|
||||
import * as Sentry from '@sentry/sveltekit';
|
||||
|
||||
if (!building) {
|
||||
Sentry.init({
|
||||
dsn: process.env.PUBLIC_SENTRY_DSN,
|
||||
tracesSampleRate: 0.2,
|
||||
environment: process.env.NODE_ENV ?? 'development',
|
||||
sendDefaultPii: true
|
||||
});
|
||||
}
|
||||
|
||||
import { auth } from '$lib/server/auth';
|
||||
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
||||
import { db } from '$lib/server/db';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import * as Sentry from '@sentry/sveltekit';
|
||||
|
||||
Sentry.init({
|
||||
dsn: process.env.PUBLIC_SENTRY_DSN,
|
||||
tracesSampleRate: 0.2,
|
||||
environment: process.env.NODE_ENV ?? 'development',
|
||||
sendDefaultPii: true
|
||||
});
|
||||
@@ -4,32 +4,14 @@ import { building } from '$app/environment';
|
||||
|
||||
const isProduction = !building && process.env.NODE_ENV === 'production';
|
||||
|
||||
const transport = building
|
||||
? undefined
|
||||
: isProduction
|
||||
? pino.transport({
|
||||
targets: [
|
||||
{ target: 'pino/file', options: { destination: 1 } },
|
||||
{
|
||||
target: 'pino/file',
|
||||
options: { destination: '/var/log/app/app.log', mkdir: true }
|
||||
}
|
||||
]
|
||||
})
|
||||
: pino.transport({
|
||||
target: 'pino-pretty',
|
||||
options: { colorize: true, translateTime: 'HH:MM:ss' }
|
||||
});
|
||||
|
||||
export const logger = pino(
|
||||
{
|
||||
level: isProduction ? 'info' : 'debug',
|
||||
base: { service: 'vash-esports' },
|
||||
serializers: pino.stdSerializers,
|
||||
redact: ['req.headers.authorization', 'req.headers.cookie']
|
||||
},
|
||||
transport
|
||||
);
|
||||
// Production: JSON to stdout (Docker captures logs via log driver)
|
||||
// Dev: pipe through pino-pretty (`bun run dev | bunx pino-pretty`)
|
||||
export const logger = pino({
|
||||
level: isProduction ? 'info' : 'debug',
|
||||
base: { service: 'vash-esports' },
|
||||
serializers: pino.stdSerializers,
|
||||
redact: ['req.headers.authorization', 'req.headers.cookie']
|
||||
});
|
||||
|
||||
// Child loggers per subsystem — maps to existing [Tag] prefixes
|
||||
export const log = {
|
||||
|
||||
Reference in New Issue
Block a user