From 0c072d8ea388e770a14cc960f8b2488f56b2d79e Mon Sep 17 00:00:00 2001 From: Belinda Cao Date: Tue, 22 Oct 2024 15:05:23 +0800 Subject: [PATCH] fix: when the enableCustomEntry is set to true, the entry.tsx should be recognized first (#6420) --- .changeset/nine-turkeys-hope.md | 7 +++++++ .../app-tools/src/plugins/analyze/getFileSystemEntry.ts | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/nine-turkeys-hope.md diff --git a/.changeset/nine-turkeys-hope.md b/.changeset/nine-turkeys-hope.md new file mode 100644 index 000000000000..2f1c1ae4ba94 --- /dev/null +++ b/.changeset/nine-turkeys-hope.md @@ -0,0 +1,7 @@ +--- +'@modern-js/app-tools': patch +--- + +fix: when the enableCustomEntry is set to true, the `entry.tsx` should be recognized first. + +fix: 开启 enableCustomEntry 后, `entry.tsx` 入口应优先被识别 diff --git a/packages/solutions/app-tools/src/plugins/analyze/getFileSystemEntry.ts b/packages/solutions/app-tools/src/plugins/analyze/getFileSystemEntry.ts index fcd7a545e517..23fb74129be6 100644 --- a/packages/solutions/app-tools/src/plugins/analyze/getFileSystemEntry.ts +++ b/packages/solutions/app-tools/src/plugins/analyze/getFileSystemEntry.ts @@ -67,7 +67,7 @@ const scanDir = async ( const customEntryFile = hasEntry(dir); const customServerEntry = hasServerEntry(dir); - if (indexFile && !customBootstrap) { + if (!enableCustomEntry && indexFile && !customBootstrap) { return { entryName, isMainEntry: false, @@ -97,6 +97,7 @@ const scanDir = async ( customEntry: enableCustomEntry ? Boolean(customEntryFile) : false, }; } + if (enableCustomEntry && customEntryFile) { return { entryName, @@ -108,6 +109,7 @@ const scanDir = async ( customEntry: Boolean(customEntryFile), }; } + return false; }), ).then(entries => entries.filter(Boolean) as Entrypoint[]);