Skip to content

Commit

Permalink
fix: pass customLogger to loadConfigFromFile (fix #15824) (#15831)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedjulius authored Feb 8, 2024
1 parent 5e5ca7d commit 55a3427
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/guide/api-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ async function loadConfigFromFile(
configFile?: string,
configRoot: string = process.cwd(),
logLevel?: LogLevel,
customLogger?: Logger,
): Promise<{
path: string
config: UserConfig
Expand Down
8 changes: 6 additions & 2 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ export async function resolveConfig(
configFile,
config.root,
config.logLevel,
config.customLogger,
)
if (loadResult) {
config = mergeConfig(loadResult.config, config)
Expand Down Expand Up @@ -963,6 +964,7 @@ export async function loadConfigFromFile(
configFile?: string,
configRoot: string = process.cwd(),
logLevel?: LogLevel,
customLogger?: Logger,
): Promise<{
path: string
config: UserConfig
Expand Down Expand Up @@ -1016,9 +1018,11 @@ export async function loadConfigFromFile(
dependencies: bundled.dependencies,
}
} catch (e) {
createLogger(logLevel).error(
createLogger(logLevel, { customLogger }).error(
colors.red(`failed to load config from ${resolvedPath}`),
{ error: e },
{
error: e,
},
)
throw e
}
Expand Down

0 comments on commit 55a3427

Please sign in to comment.