Skip to content

Commit

Permalink
force resolved to be an array in maybeEmitDep
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Dec 3, 2022
1 parent 50d1707 commit 0118697
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/node-file-trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,12 @@ export class Job {
return;
}

if (Array.isArray(resolved)) {
for (const item of resolved) {
// ignore builtins
if (item.startsWith('node:')) return;
await this.analyzeAndEmitDependency(item, path, cjsResolve);
}
} else {
// For simplicity, force `resolved` to be an array
resolved = Array.isArray(resolved) ? resolved : [resolved];
for (const item of resolved) {
// ignore builtins
if (resolved.startsWith('node:')) return;
await this.analyzeAndEmitDependency(resolved, path, cjsResolve);
if (item.startsWith('node:')) return;
await this.analyzeAndEmitDependency(item, path, cjsResolve);
}
}

Expand Down

0 comments on commit 0118697

Please sign in to comment.