Fix logLevel passed to Vite build (#8678)

This commit is contained in:
Bjorn Lu 2023-09-27 22:30:30 +08:00 committed by GitHub
parent aad756297c
commit e8495c853b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix logLevel passed to Vite build

View file

@ -154,7 +154,8 @@ async function ssrBuild(
const viteBuildConfig: vite.InlineConfig = {
...viteConfig,
mode: viteConfig.mode || 'production',
logLevel: opts.viteConfig.logLevel ?? 'error',
// Check using `settings...` as `viteConfig` always defaults to `warn` by Astro
logLevel: settings.config.vite.logLevel ?? 'error',
build: {
target: 'esnext',
// Vite defaults cssMinify to false in SSR by default, but we want to minify it
@ -260,7 +261,8 @@ async function clientBuild(
const viteBuildConfig: vite.InlineConfig = {
...viteConfig,
mode: viteConfig.mode || 'production',
logLevel: 'info',
// Check using `settings...` as `viteConfig` always defaults to `warn` by Astro
logLevel: settings.config.vite.logLevel ?? 'info',
build: {
target: 'esnext',
...viteConfig.build,

View file

@ -243,8 +243,6 @@ export async function createVite(
}
result = vite.mergeConfig(result, commandConfig);
result.customLogger = vite.createLogger(result.logLevel ?? 'warn');
return result;
}