diff --git a/src/compiler/parser/html-parser.js b/src/compiler/parser/html-parser.js
index 86955e0e7ab..e2203613204 100644
--- a/src/compiler/parser/html-parser.js
+++ b/src/compiler/parser/html-parser.js
@@ -22,7 +22,8 @@ const startTagOpen = new RegExp(`^<${qnameCapture}`)
const startTagClose = /^\s*(\/?)>/
const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`)
const doctype = /^]+>/i
-const comment = /^/g, '$1')
+ .replace(//g, '$1') // #7298
.replace(//g, '$1')
}
if (shouldIgnoreFirstNewline(stackedTag, text)) {