fix(compiler-ssr): handle comments codegen + refactor ssr codegen transform

This commit is contained in:
Evan You
2020-05-01 17:04:36 -04:00
parent 0e730c06e4
commit 6c60ce13e0
5 changed files with 85 additions and 27 deletions

View File

@@ -43,3 +43,10 @@ export function escapeHtml(string: unknown) {
return lastIndex !== index ? html + str.substring(lastIndex, index) : html
}
// https://www.w3.org/TR/html52/syntax.html#comments
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g
export function escapeHtmlComment(src: string): string {
return src.replace(commentStripRE, '')
}