Skip to content

Commit

Permalink
fix(scanner): duplicate modules for same id if glob is used in html-l…
Browse files Browse the repository at this point in the history
…ike types (#16305)
  • Loading branch information
sapphi-red authored Mar 29, 2024
1 parent ad246da commit eca68fa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,10 @@ function esbuildScanPlugin(
// Avoid matching the content of the comment
raw = raw.replace(commentRE, '<!---->')
const isHtml = p.endsWith('.html')
scriptRE.lastIndex = 0
let js = ''
let scriptId = 0
let match: RegExpExecArray | null
while ((match = scriptRE.exec(raw))) {
const [, openTag, content] = match
const matches = raw.matchAll(scriptRE)
for (const [, openTag, content] of matches) {
const typeMatch = openTag.match(typeRE)
const type =
typeMatch && (typeMatch[1] || typeMatch[2] || typeMatch[3])
Expand Down

0 comments on commit eca68fa

Please sign in to comment.