Skip to content

Commit

Permalink
fix(build): css tags injection priority (#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
thundernet8 committed Feb 26, 2021
1 parent 4984a48 commit 55ad23e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/vite/src/node/plugins/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
seen: Set<string> = new Set()
): HtmlTagDescriptor[] => {
const tags: HtmlTagDescriptor[] = []
chunk.imports.forEach((file) => {
const importee = bundle[file]
if (importee && importee.type === 'chunk') {
tags.push(...getCssTagsForChunk(importee, seen))
}
})
const cssFiles = chunkToEmittedCssFileMap.get(chunk)
if (cssFiles) {
cssFiles.forEach((file) => {
Expand All @@ -309,12 +315,6 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
}
})
}
chunk.imports.forEach((file) => {
const importee = bundle[file]
if (importee && importee.type === 'chunk') {
tags.push(...getCssTagsForChunk(importee, seen))
}
})
return tags
}

Expand Down

0 comments on commit 55ad23e

Please sign in to comment.