Skip to content

Commit

Permalink
fix(scan): avoid breaking html comment regex inside script of scanned…
Browse files Browse the repository at this point in the history
… html-like files
  • Loading branch information
yyx990803 committed Jun 21, 2021
1 parent 1222727 commit bb095db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function esbuildScanPlugin(
async ({ path }) => {
let raw = fs.readFileSync(path, 'utf-8')
// Avoid matching the content of the comment
raw = raw.replace(commentRE, '')
raw = raw.replace(commentRE, '<!---->')
const isHtml = path.endsWith('.html')
const regex = isHtml ? scriptModuleRE : scriptRE
regex.lastIndex = 0
Expand Down

0 comments on commit bb095db

Please sign in to comment.