Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module-federation): support buildable libs #20786

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

Coly010
Copy link
Contributor

@Coly010 Coly010 commented Dec 15, 2023

Current Behavior

Buildable libs are not consumed from dist when using MF when creating shared deps

Expected Behavior

Buildable libs should be consumed from dist when creating shared deps

Related Issue(s)

Fixes #20491

@Coly010 Coly010 requested review from jaysoo and a team as code owners December 15, 2023 13:27
@Coly010 Coly010 self-assigned this Dec 15, 2023
Copy link

vercel bot commented Dec 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Dec 15, 2023 1:33pm

@@ -57,12 +62,32 @@ function getLibraryImportPath(
library: string,
projectGraph: ProjectGraph
): string | undefined {
let buildLibsFromSource = true;
if (process.env.NX_BUILD_LIBS_FROM_SOURCE) {
Copy link
Member

Choose a reason for hiding this comment

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

We can find this info from NX_TASK_TARGET_PROJECT and NX_TASK_TARGET_TARGET? Do we need the extra env var from executor?

Users won't be able to override with CLI options like --buildLibsFromSource=false but I think that's fine.

Copy link
Contributor Author

@Coly010 Coly010 Dec 15, 2023

Choose a reason for hiding this comment

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

I used a separate one because of cases where a new process isn't spawned, those env vars match the parent process (the host) and not the child (the remote) and for cases where the parent process is actually a serve that needs to do a build first.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, interesting. Maybe something to clean-up later if we can move buildLibsFromSource to a normal webpack plugin then we wouldn't need all the env vars to be passed like this.

@Coly010 Coly010 enabled auto-merge (squash) December 15, 2023 15:46
@Coly010 Coly010 merged commit a9a676a into nrwl:master Dec 15, 2023
6 checks passed
@Coly010 Coly010 deleted the mf/support-buildable-libs branch December 15, 2023 16:23
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When compiling the library bundle,when use mf the singleton pattern for the service does not take effect.
3 participants