@@ -792,7 +792,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
792
792
await urlEmitQueue . run ( async ( ) =>
793
793
Promise . all (
794
794
urlEmitTasks . map ( async ( info ) => {
795
- info . content = await finalizeCss ( info . content , true , config )
795
+ info . content = await finalizeCss ( info . content , config )
796
796
} ) ,
797
797
) ,
798
798
)
@@ -863,7 +863,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
863
863
864
864
// wait for previous tasks as well
865
865
chunkCSS = await codeSplitEmitQueue . run ( async ( ) => {
866
- return finalizeCss ( chunkCSS ! , true , config )
866
+ return finalizeCss ( chunkCSS ! , config )
867
867
} )
868
868
869
869
// emit corresponding css file
@@ -886,7 +886,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
886
886
// But because entry chunk can be imported by dynamic import,
887
887
// we shouldn't remove the inlined CSS. (#10285)
888
888
889
- chunkCSS = await finalizeCss ( chunkCSS , true , config )
889
+ chunkCSS = await finalizeCss ( chunkCSS , config )
890
890
let cssString = JSON . stringify ( chunkCSS )
891
891
cssString =
892
892
renderAssetUrlInJS ( this , chunk , opts , cssString ) ?. toString ( ) ||
@@ -989,7 +989,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
989
989
// Finally, if there's any extracted CSS, we emit the asset
990
990
if ( extractedCss ) {
991
991
hasEmitted = true
992
- extractedCss = await finalizeCss ( extractedCss , true , config )
992
+ extractedCss = await finalizeCss ( extractedCss , config )
993
993
this . emitFile ( {
994
994
name : getCssBundleName ( ) ,
995
995
type : 'asset' ,
@@ -1802,16 +1802,12 @@ function combineSourcemapsIfExists(
1802
1802
const viteHashUpdateMarker = '/*$vite$:1*/'
1803
1803
const viteHashUpdateMarkerRE = / \/ \* \$ v i t e \$ : \d + \* \/ /
1804
1804
1805
- async function finalizeCss (
1806
- css : string ,
1807
- minify : boolean ,
1808
- config : ResolvedConfig ,
1809
- ) {
1805
+ async function finalizeCss ( css : string , config : ResolvedConfig ) {
1810
1806
// hoist external @imports and @charset to the top of the CSS chunk per spec (#1845 and #6333)
1811
1807
if ( css . includes ( '@import' ) || css . includes ( '@charset' ) ) {
1812
1808
css = await hoistAtRules ( css )
1813
1809
}
1814
- if ( minify && config . build . cssMinify ) {
1810
+ if ( config . build . cssMinify ) {
1815
1811
css = await minifyCSS ( css , config , false )
1816
1812
}
1817
1813
// inject an additional string to generate a different hash for https://github.com/vitejs/vite/issues/18038
0 commit comments