Skip to content

Commit

Permalink
perf: legacy avoid insert the entry module css (#9761)
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed Aug 19, 2022
1 parent 7ba0c9f commit 0765ab8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -557,6 +557,14 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
})
chunk.viteMetadata.importedCss.add(this.getFileName(fileHandle))
} else if (!config.build.ssr) {
// legacy build and inline css

// the legacy build should avoid inserting entry CSS modules here, they
// will be collected into `chunk.viteMetadata.importedCss` and injected
// later by the `'vite:build-html'` plugin into the `index.html`
if (chunk.isEntry) {
return null
}
chunkCSS = await finalizeCss(chunkCSS, true, config)
let cssString = JSON.stringify(chunkCSS)
cssString =
Expand Down

0 comments on commit 0765ab8

Please sign in to comment.