diff --git a/packages/knip/src/index.ts b/packages/knip/src/index.ts index 7c7787b6d..e46f2a3c6 100644 --- a/packages/knip/src/index.ts +++ b/packages/knip/src/index.ts @@ -211,7 +211,7 @@ export const main = async (unresolvedConfiguration: CommandLineOptions) => { const ws = (dependency.containingFilePath && chief.findWorkspaceByFilePath(dependency.containingFilePath)) || workspace; const specifierFilePath = getReferencedInternalFilePath(dependency, ws); - if (specifierFilePath) principal.addEntryPath(specifierFilePath); + if (specifierFilePath) principal.addEntryPath(specifierFilePath, { skipExportsAnalysis: true }); } } diff --git a/packages/knip/test/include-entry-exports-scripts.test.ts b/packages/knip/test/include-entry-exports-scripts.test.ts index 3b157df3a..67d311554 100644 --- a/packages/knip/test/include-entry-exports-scripts.test.ts +++ b/packages/knip/test/include-entry-exports-scripts.test.ts @@ -21,7 +21,7 @@ test('Skip unused exports in entry source files and scripts', async () => { }); }); -test('Report unused exports in source files and scripts (skip for plugin entry files)', async () => { +test('Report unused exports in source files (skip for scripts and plugin entry files)', async () => { const { counters } = await main({ ...baseArguments, cwd, @@ -30,7 +30,7 @@ test('Report unused exports in source files and scripts (skip for plugin entry f assert.deepEqual(counters, { ...baseCounters, - exports: 5, + exports: 0, // skip for scripts and plugin entry files processed: 5, total: 5, });