fix: vite conflicted configures
Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
3cda8aa60b
commit
13b09e7bb9
1 changed files with 6 additions and 5 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue