fix!: default build.cssMinify to 'esbuild' for SSR (#15637)

This commit is contained in:
翠 / green 2024-10-24 19:01:59 +09:00 committed by GitHub
parent 0a4427fc44
commit f1d3bf74cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -130,7 +130,7 @@ In this case, you need to set `build.cssTarget` to `chrome61` to prevent vite fr
## build.cssMinify
- **Type:** `boolean | 'esbuild' | 'lightningcss'`
- **Default:** the same as [`build.minify`](#build-minify)
- **Default:** the same as [`build.minify`](#build-minify) for client, `'esbuild'` for SSR
This option allows users to override CSS minification specifically instead of defaulting to `build.minify`, so you can configure minification for JS and CSS separately. Vite uses `esbuild` by default to minify CSS. Set the option to `'lightningcss'` to use [Lightning CSS](https://lightningcss.dev/minification.html) instead. If selected, it can be configured using [`css.lightningcss`](./shared-options.md#css-lightningcss).

View File

@ -24,6 +24,8 @@ Vite 6 also introduces a new default value for `json.stringify` which is `'auto'
There are other breaking changes which only affect few users.
- [[#15637] fix!: default `build.cssMinify` to `'esbuild'` for SSR](https://github.com/vitejs/vite/pull/15637)
- [`build.cssMinify`](/config/build-options#build-cssminify) is now enabled by default even for SSR builds.
- [[#18209] refactor!: bump minimal terser version to 5.16.0](https://github.com/vitejs/vite/pull/18209)
- Minimal supported terser version for [`build.minify: 'terser'`](/config/build-options#build-minify) was bumped to 5.16.0 from 5.4.0.
- [[#18243] chore(deps)!: migrate `fast-glob` to `tinyglobby`](https://github.com/vitejs/vite/pull/18243)

View File

@ -369,7 +369,7 @@ export function resolveBuildEnvironmentOptions(
cssCodeSplit: !raw.lib,
sourcemap: false,
rollupOptions: {},
minify: raw.ssr ? false : 'esbuild',
minify: consumer === 'server' ? false : 'esbuild',
terserOptions: {},
write: true,
emptyOutDir: null,
@ -434,7 +434,7 @@ export function resolveBuildEnvironmentOptions(
}
if (resolved.cssMinify == null) {
resolved.cssMinify = !!resolved.minify
resolved.cssMinify = consumer === 'server' ? 'esbuild' : !!resolved.minify
}
return resolved