Skip to content

Commit d487063

Browse files
committed
chore: fix mishandled regex const check
1 parent 4121de4 commit d487063

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/compiler-core/src/babelUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,6 @@ export function isStaticNode(node: Node): boolean {
544544
case 'BooleanLiteral':
545545
case 'NullLiteral':
546546
case 'BigIntLiteral':
547-
case 'RegExpLiteral':
548547
return true
549548
}
550549
return false
@@ -558,6 +557,8 @@ export function isConstantNode(node: Node, bindings: BindingMetadata): boolean {
558557
case 'Identifier':
559558
const type = bindings[node.name]
560559
return type === BindingTypes.LITERAL_CONST
560+
case 'RegExpLiteral':
561+
return true
561562
case 'ObjectExpression':
562563
return node.properties.every(prop => {
563564
// { bar() {} } object methods are not considered static nodes

0 commit comments

Comments
 (0)