We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad246da commit eca68faCopy full SHA for eca68fa
packages/vite/src/node/optimizer/scan.ts
@@ -409,12 +409,10 @@ function esbuildScanPlugin(
409
// Avoid matching the content of the comment
410
raw = raw.replace(commentRE, '<!---->')
411
const isHtml = p.endsWith('.html')
412
- scriptRE.lastIndex = 0
413
let js = ''
414
let scriptId = 0
415
- let match: RegExpExecArray | null
416
- while ((match = scriptRE.exec(raw))) {
417
- const [, openTag, content] = match
+ const matches = raw.matchAll(scriptRE)
+ for (const [, openTag, content] of matches) {
418
const typeMatch = openTag.match(typeRE)
419
const type =
420
typeMatch && (typeMatch[1] || typeMatch[2] || typeMatch[3])
0 commit comments