diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 57970a7a66d991..85d1f16c536ac6 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -89,7 +89,7 @@ import { resolveSSROptions } from './ssr' import { PartialEnvironment } from './baseEnvironment' import { createIdResolver } from './idResolver' -const debug = createDebugger('vite:config') +const debug = createDebugger('vite:config', { depth: 10 }) const promisifiedRealpath = promisify(fs.realpath) export interface ConfigEnv { diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index a99d9e5403fd63..2a5faa6cc8079d 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -156,6 +156,7 @@ const DEBUG = process.env.DEBUG interface DebuggerOptions { onlyWhenFocused?: boolean | string + depth?: number } export type ViteDebugScope = `vite:${string}` @@ -165,7 +166,13 @@ export function createDebugger( options: DebuggerOptions = {}, ): debug.Debugger['log'] | undefined { const log = debug(namespace) - const { onlyWhenFocused } = options + const { onlyWhenFocused, depth } = options + + // @ts-expect-error - The log function is bound to inspectOpts, but the type is not reflected + if (depth && log.inspectOpts.depth == null) { + // @ts-expect-error - The log function is bound to inspectOpts, but the type is not reflected + log.inspectOpts.depth = options.depth + } let enabled = log.enabled if (enabled && onlyWhenFocused) {