Skip to content

Commit

Permalink
perf: legacy avoid insert the entry module css
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed Aug 19, 2022
1 parent 518bc6c commit 28f938f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
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

// simple build will collect all entry module css into chunk.viteMetadata.importedCss
// and inject into the `index.html` same with legacy
// legacy build should avoid insert the entry module css again
if (chunk.isEntry) {
return null
}
chunkCSS = await finalizeCss(chunkCSS, true, config)
let cssString = JSON.stringify(chunkCSS)
cssString =
Expand Down

0 comments on commit 28f938f

Please sign in to comment.