Skip to content

Commit ee499ae

Browse files
authored
fix: handle dtsOnly flag in dependency parsing (#56)
1 parent 6529060 commit ee499ae

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/helper.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,19 @@ export function parseTasks(
5959

6060
for (const dep of dependencies) {
6161
const depName = typeof dep === 'string' ? dep : dep.name;
62+
const dtsOnly = typeof dep === 'string' ? false : (dep.dtsOnly ?? false);
6263
const importPath = join(cwd, DIST_DIR, depName);
6364
const distPath = join(cwd, DIST_DIR, depName);
64-
const depPath = findDepPath(depName);
65+
const depPath = dtsOnly ? null : findDepPath(depName);
6566

66-
if (!depPath) {
67+
if (!depPath && !dtsOnly) {
6768
throw new Error(`Failed to resolve dependency: ${depName}`);
6869
}
6970

70-
const depEntry = require.resolve(depName, { paths: [cwd] });
71+
const depEntry = dtsOnly ? '' : require.resolve(depName, { paths: [cwd] });
7172
const info = {
7273
depName,
73-
depPath,
74+
depPath: depPath ?? '',
7475
depEntry,
7576
distPath,
7677
importPath,

0 commit comments

Comments
 (0)