Skip to content

Commit

Permalink
When in flat mode don't add unused dependencies - fixes #2781 (#3251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian McKenzie authored and bestander committed Apr 25, 2017
1 parent 0150890 commit 2458758
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cli/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ export class Install {
if (ignoreUnusedPatterns && !isUsed) {
return;
}
// We only take unused dependencies into consideration to get deterministic hoisting.
// Since flat mode doesn't care about hoisting and everything is top level and specified then we can safely
// leave these out.
if (this.flags.flat && !isUsed) {
return;
}
const depMap = json[depType];
for (const name in depMap) {
if (excludeNames.indexOf(name) >= 0) {
Expand Down

0 comments on commit 2458758

Please sign in to comment.