ソースを参照

chore: fix mishandled regex const check

Evan You 1 年間 前
コミット
d48706336a
1 ファイル変更2 行追加1 行削除
  1. 2 1
      packages/compiler-core/src/babelUtils.ts

+ 2 - 1
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