From 13b09e7bb97930721560f9b9c11ef80ea4268c4b Mon Sep 17 00:00:00 2001 From: "pakintada@gmail.com" Date: Wed, 1 Jul 2026 17:36:21 +0700 Subject: [PATCH] fix: vite conflicted configures Signed-off-by: pakintada@gmail.com --- src/lib/core/utils/logger.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/core/utils/logger.ts b/src/lib/core/utils/logger.ts index cd27c38..3d422d2 100644 --- a/src/lib/core/utils/logger.ts +++ b/src/lib/core/utils/logger.ts @@ -14,7 +14,7 @@ * logger.error('Failed:', err) * inspector.error('auth failure', uid) // always visible */ -import { configureSync, getConsoleSink, withFilter, getLogger } from '@logtape/logtape'; +import { configureSync, getConfig, getConsoleSink, withFilter, getLogger } from '@logtape/logtape'; // --------------------------------------------------------------------------- // Environment helpers @@ -24,13 +24,14 @@ const IS_DEV = import.meta.env.DEV; const ENV_LOG_LEVEL = (import.meta.env.PUBLIC_APP_LOG_LEVEL as string) || (IS_DEV ? 'trace' : 'info'); // --------------------------------------------------------------------------- -// LogTape configuration (singleton guard for Vite HMR / config reload) +// LogTape configuration (idempotent — uses getConfig() not a local flag) // --------------------------------------------------------------------------- -let _configured = false; function ensureConfigured() { - if (_configured) return; - _configured = true; + // Vite evaluates the config module twice during build (SSR + client). + // A local `_configured` boolean resets between evaluations, so we + // rely on LogTape's own global state instead. + if (getConfig() !== null) return; configureSync({ sinks: { console: getConsoleSink(),