From 3f3f3d1893f723726e51b2a361a88e92d5e1b830 Mon Sep 17 00:00:00 2001 From: StringKE <31089228+StringKe@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:29:27 +0000 Subject: [PATCH 1/2] support SyntaxKind.Identifier --- src/compilers/getIsIsolatedModules.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compilers/getIsIsolatedModules.ts b/src/compilers/getIsIsolatedModules.ts index c824770..37d5c64 100644 --- a/src/compilers/getIsIsolatedModules.ts +++ b/src/compilers/getIsIsolatedModules.ts @@ -77,6 +77,11 @@ export default function getIsIsolatedModules( return false; } + // Identifier + if (exportedDeclarationNode.getKind() === tsm.SyntaxKind.Identifier) { + return true; + } + throw new Error( `Cannot support type: (${exportedDeclarationNode.getKind()}) ${exportedDeclarationNode.getText()}`, ); From ca5cc43157a299991c06e13f140a1132bc16668c Mon Sep 17 00:00:00 2001 From: StringKE <31089228+StringKe@users.noreply.github.com> Date: Mon, 23 Oct 2023 09:57:31 +0800 Subject: [PATCH 2/2] Update getIsIsolatedModules.ts --- src/compilers/getIsIsolatedModules.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compilers/getIsIsolatedModules.ts b/src/compilers/getIsIsolatedModules.ts index 37d5c64..c6be4e8 100644 --- a/src/compilers/getIsIsolatedModules.ts +++ b/src/compilers/getIsIsolatedModules.ts @@ -65,6 +65,11 @@ export default function getIsIsolatedModules( return true; } + // Identifier + if (exportedDeclarationNode.asKind(tsm.SyntaxKind.Identifier) != null) { + return false; + } + // SourceFile(like Vue.js components) // eg. // @@ -77,11 +82,6 @@ export default function getIsIsolatedModules( return false; } - // Identifier - if (exportedDeclarationNode.getKind() === tsm.SyntaxKind.Identifier) { - return true; - } - throw new Error( `Cannot support type: (${exportedDeclarationNode.getKind()}) ${exportedDeclarationNode.getText()}`, );