Skip to content

Commit 8099582

Browse files
authored
refactor: remove unnecessary minify parameter from finalizeCss (#20701)
1 parent 63244e8 commit 8099582

File tree

1 file changed

+6
-10
lines changed
  • packages/vite/src/node/plugins

1 file changed

+6
-10
lines changed

packages/vite/src/node/plugins/css.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
792792
await urlEmitQueue.run(async () =>
793793
Promise.all(
794794
urlEmitTasks.map(async (info) => {
795-
info.content = await finalizeCss(info.content, true, config)
795+
info.content = await finalizeCss(info.content, config)
796796
}),
797797
),
798798
)
@@ -863,7 +863,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
863863

864864
// wait for previous tasks as well
865865
chunkCSS = await codeSplitEmitQueue.run(async () => {
866-
return finalizeCss(chunkCSS!, true, config)
866+
return finalizeCss(chunkCSS!, config)
867867
})
868868

869869
// emit corresponding css file
@@ -886,7 +886,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
886886
// But because entry chunk can be imported by dynamic import,
887887
// we shouldn't remove the inlined CSS. (#10285)
888888

889-
chunkCSS = await finalizeCss(chunkCSS, true, config)
889+
chunkCSS = await finalizeCss(chunkCSS, config)
890890
let cssString = JSON.stringify(chunkCSS)
891891
cssString =
892892
renderAssetUrlInJS(this, chunk, opts, cssString)?.toString() ||
@@ -989,7 +989,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
989989
// Finally, if there's any extracted CSS, we emit the asset
990990
if (extractedCss) {
991991
hasEmitted = true
992-
extractedCss = await finalizeCss(extractedCss, true, config)
992+
extractedCss = await finalizeCss(extractedCss, config)
993993
this.emitFile({
994994
name: getCssBundleName(),
995995
type: 'asset',
@@ -1802,16 +1802,12 @@ function combineSourcemapsIfExists(
18021802
const viteHashUpdateMarker = '/*$vite$:1*/'
18031803
const viteHashUpdateMarkerRE = /\/\*\$vite\$:\d+\*\//
18041804

1805-
async function finalizeCss(
1806-
css: string,
1807-
minify: boolean,
1808-
config: ResolvedConfig,
1809-
) {
1805+
async function finalizeCss(css: string, config: ResolvedConfig) {
18101806
// hoist external @imports and @charset to the top of the CSS chunk per spec (#1845 and #6333)
18111807
if (css.includes('@import') || css.includes('@charset')) {
18121808
css = await hoistAtRules(css)
18131809
}
1814-
if (minify && config.build.cssMinify) {
1810+
if (config.build.cssMinify) {
18151811
css = await minifyCSS(css, config, false)
18161812
}
18171813
// inject an additional string to generate a different hash for https://github.com/vitejs/vite/issues/18038

0 commit comments

Comments
 (0)