diff --git a/.changeset/fast-glasses-remain.md b/.changeset/fast-glasses-remain.md new file mode 100644 index 000000000..5a7361b90 --- /dev/null +++ b/.changeset/fast-glasses-remain.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix logLevel passed to Vite build diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 2d4f41f48..149b6760d 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -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, diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 5848bbe53..3c59b1fb4 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -243,8 +243,6 @@ export async function createVite( } result = vite.mergeConfig(result, commandConfig); - result.customLogger = vite.createLogger(result.logLevel ?? 'warn'); - return result; }