diff --git a/packages/compiler-core/src/babelUtils.ts b/packages/compiler-core/src/babelUtils.ts index ccf123f7b..6ede6bd03 100644 --- a/packages/compiler-core/src/babelUtils.ts +++ b/packages/compiler-core/src/babelUtils.ts @@ -544,7 +544,6 @@ export function isStaticNode(node: Node): boolean { case 'BooleanLiteral': case 'NullLiteral': case 'BigIntLiteral': - case 'RegExpLiteral': return true } return false @@ -558,6 +557,8 @@ export function isConstantNode(node: Node, bindings: BindingMetadata): boolean { case 'Identifier': const type = bindings[node.name] return type === BindingTypes.LITERAL_CONST + case 'RegExpLiteral': + return true case 'ObjectExpression': return node.properties.every(prop => { // { bar() {} } object methods are not considered static nodes