Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
psaren committed Apr 10, 2021
1 parent e70c80e commit 9031491
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vite/src/node/plugins/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
},

async generateBundle(_, bundle) {
const analyzedChunk: Set<string> = new Set<string>()
const getPreloadLinksForChunk = (
chunk: OutputChunk,
seen: Set<string> = new Set()
Expand Down Expand Up @@ -296,7 +297,12 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
const tags: HtmlTagDescriptor[] = []
chunk.imports.forEach((file) => {
const importee = bundle[file]
if (importee && importee.type === 'chunk') {
if (
importee &&
importee.type === 'chunk' &&
!analyzedChunk.has(importee.fileName)
) {
analyzedChunk.add(importee.fileName)
tags.push(...getCssTagsForChunk(importee, seen))
}
})
Expand Down

0 comments on commit 9031491

Please sign in to comment.