Skip to content

Commit

Permalink
fix(misc): filter out deps early based on shared config from module f…
Browse files Browse the repository at this point in the history
…ederation (#15654)

(cherry picked from commit e2a2703)
  • Loading branch information
leosvelperez authored and FrozenPandaz committed Mar 15, 2023
1 parent d0e831e commit 6e49fae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/angular/src/utils/mf/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ export async function getModuleFederationConfig(
projectGraph,
mfConfig.name
);

if (mfConfig.shared) {
dependencies.workspaceLibraries = dependencies.workspaceLibraries.filter(
(lib) => mfConfig.shared(lib.name, {})
);
dependencies.npmPackages = dependencies.npmPackages.filter((pkg) =>
mfConfig.shared(pkg, {})
);
}

const sharedLibraries = shareWorkspaceLibraries(
dependencies.workspaceLibraries
);
Expand Down
10 changes: 10 additions & 0 deletions packages/react/src/module-federation/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ export async function getModuleFederationConfig(
projectGraph,
mfConfig.name
);

if (mfConfig.shared) {
dependencies.workspaceLibraries = dependencies.workspaceLibraries.filter(
(lib) => mfConfig.shared(lib.name, {})
);
dependencies.npmPackages = dependencies.npmPackages.filter((pkg) =>
mfConfig.shared(pkg, {})
);
}

const sharedLibraries = shareWorkspaceLibraries(
dependencies.workspaceLibraries
);
Expand Down

1 comment on commit 6e49fae

@barrymichaeldoyle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this commit is the cause of problems that many people are facing in issues like this: #15811

Please sign in to comment.