Skip to content

Commit

Permalink
fix(css): fix extract concurrency issue when disabling cssCodeSplit
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 24, 2021
1 parent 16b919e commit 4ac7e7e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -277,9 +277,11 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
}
}
} else {
const extractedCss = outputToExtractedCSSMap.get(opts) || ''
chunkCSS = await processChunkCSS(chunkCSS, config, this, false)
outputToExtractedCSSMap.set(opts, extractedCss + chunkCSS)
chunkCSS = await processChunkCSS(chunkCSS, config, this, false, false)
outputToExtractedCSSMap.set(
opts,
(outputToExtractedCSSMap.get(opts) || '') + chunkCSS
)
}
return null
},
Expand Down Expand Up @@ -738,7 +740,8 @@ async function processChunkCSS(
css: string,
config: ResolvedConfig,
pluginCtx: PluginContext,
isInlined: boolean
isInlined: boolean,
minify = true
): Promise<string> {
// replace asset url references with resolved url.
const isRelativeBase = config.base === '' || config.base.startsWith('.')
Expand All @@ -753,7 +756,7 @@ async function processChunkCSS(
return `./${path.posix.basename(filename)}`
}
})
if (config.build.minify) {
if (minify && config.build.minify) {
css = await minifyCSS(css, config)
}
return css
Expand Down

0 comments on commit 4ac7e7e

Please sign in to comment.