Skip to content

Commit

Permalink
fix(externals): exclude option to filter peer deps install of externals
Browse files Browse the repository at this point in the history
  • Loading branch information
olup committed Apr 14, 2021
1 parent 00e8537 commit 6b02446
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pack-externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,15 @@ function getProdModules(

const modulePackage = require(modulePackagePath);

// find peer dependencies but remove optional ones
// find peer dependencies but remove optional ones and excluded ones
const peerDependencies = modulePackage.peerDependencies as Record<string, string>;
const optionalPeerDependencies = Object.keys(
pickBy((val, key) => !val.optionnal, modulePackage.peerDependenciesMeta || {})
);
const peerDependenciesWithoutOptionals = omit(optionalPeerDependencies, peerDependencies);
const peerDependenciesWithoutOptionals = omit(
[...optionalPeerDependencies, ...this.buildOptions.exclude],
peerDependencies
);

if (!isEmpty(peerDependenciesWithoutOptionals)) {
this.options.verbose &&
Expand Down

0 comments on commit 6b02446

Please sign in to comment.