From 28948dd1d19c1941d40b26220f5f9273e7c402aa Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Wed, 24 Jan 2024 14:04:06 +0300 Subject: [PATCH] fix: inner graph --- lib/optimize/InnerGraphPlugin.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/optimize/InnerGraphPlugin.js b/lib/optimize/InnerGraphPlugin.js index 1e97e578d4f..071f31ab9ef 100644 --- a/lib/optimize/InnerGraphPlugin.js +++ b/lib/optimize/InnerGraphPlugin.js @@ -161,7 +161,6 @@ class InnerGraphPlugin { decl.init && decl.id.type === "Identifier" ) { - parser.walkExpression(decl.init); const name = decl.id.name; if ( decl.init.type === "ClassExpression" && @@ -178,7 +177,6 @@ class InnerGraphPlugin { ) { pureDeclarators.add(decl); } - return true; } } }); @@ -243,7 +241,6 @@ class InnerGraphPlugin { statement.id ? statement.id.range[1] : statement.range[0] ) ) { - console.log("classExtendsExpression"); InnerGraph.setTopLevelSymbol(parser.state, fn); onUsageSuper(expr); } @@ -338,6 +335,15 @@ class InnerGraphPlugin { parser.walkExpression(decl.init); InnerGraph.setTopLevelSymbol(parser.state, undefined); return true; + } else if ( + decl.id.type === "Identifier" && + decl.init && + decl.init.type === "ClassExpression" && + classWithTopLevelSymbol.has(decl.init) + ) { + parser.walkExpression(decl.init); + InnerGraph.setTopLevelSymbol(parser.state, undefined); + return true; } });