fix(compiler-core): preserve comment content in production when comments option is enabled

This commit is contained in:
Evan You 2021-04-28 11:22:16 -04:00
parent 1d1af403ca
commit e486254431

View File

@ -738,13 +738,11 @@ function genExpressionAsPropertyKey(
} }
function genComment(node: CommentNode, context: CodegenContext) { function genComment(node: CommentNode, context: CodegenContext) {
if (__DEV__) {
const { push, helper, pure } = context const { push, helper, pure } = context
if (pure) { if (pure) {
push(PURE_ANNOTATION) push(PURE_ANNOTATION)
} }
push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node) push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node)
}
} }
function genVNodeCall(node: VNodeCall, context: CodegenContext) { function genVNodeCall(node: VNodeCall, context: CodegenContext) {