From 93dca2a208b8895d4d77d965eac091aee6e5216d Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 10 Mar 2026 11:37:36 +0800 Subject: [PATCH] fix: handle dtsOnly flag in dependency parsing --- src/helper.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/helper.ts b/src/helper.ts index 33a9ab1..02edfc3 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -59,18 +59,19 @@ export function parseTasks( for (const dep of dependencies) { const depName = typeof dep === 'string' ? dep : dep.name; + const dtsOnly = typeof dep === 'string' ? false : (dep.dtsOnly ?? false); const importPath = join(cwd, DIST_DIR, depName); const distPath = join(cwd, DIST_DIR, depName); - const depPath = findDepPath(depName); + const depPath = dtsOnly ? null : findDepPath(depName); - if (!depPath) { + if (!depPath && !dtsOnly) { throw new Error(`Failed to resolve dependency: ${depName}`); } - const depEntry = require.resolve(depName, { paths: [cwd] }); + const depEntry = dtsOnly ? '' : require.resolve(depName, { paths: [cwd] }); const info = { depName, - depPath, + depPath: depPath ?? '', depEntry, distPath, importPath,