[chore] replaces hard-coded minify
values with vite.build.minify
(#4803)
* [chore] replaces hard-coded `minify` values with `vite.build.minify` * [style] changes ternary to not-equals Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * [chore] removes `minify` in favor of user config & Vite defaults Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
parent
4d1b1b583b
commit
f53d97d56b
3 changed files with 7 additions and 2 deletions
5
.changeset/tender-nails-sip.md
Normal file
5
.changeset/tender-nails-sip.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
replaces hard-coded `minify` values with `vite.build.minify`
|
|
@ -199,7 +199,6 @@ async function clientBuild(
|
|||
target: 'esnext',
|
||||
...viteConfig.build,
|
||||
emptyOutDir: false,
|
||||
minify: 'esbuild',
|
||||
outDir: fileURLToPath(out),
|
||||
rollupOptions: {
|
||||
...viteConfig.build?.rollupOptions,
|
||||
|
|
|
@ -239,9 +239,10 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[]
|
|||
if (output.type === 'asset') {
|
||||
if (output.name?.endsWith('.css') && typeof output.source === 'string') {
|
||||
const cssTarget = settings.config.vite.build?.cssTarget;
|
||||
const minify = settings.config.vite.build?.minify !== false
|
||||
const { code: minifiedCSS } = await esbuild.transform(output.source, {
|
||||
loader: 'css',
|
||||
minify: true,
|
||||
minify,
|
||||
...(cssTarget ? { target: cssTarget } : {}),
|
||||
});
|
||||
output.source = minifiedCSS;
|
||||
|
|
Loading…
Reference in a new issue