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

feat(module-federation): add NxModuleFederationPlugin for inferred usage #30003

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

Coly010
Copy link
Contributor

@Coly010 Coly010 commented Feb 12, 2025

Current Behaviour

Currently, Module Federation with Nx is forced to use executors to provide the best DX.

Expected Behaviour

As part of the transition to inferred targets, we will need Rspack plugins that replicates the DX provided by our executors.
Add NxModuleFederationPlugin and NxModuleFederationDevServerPlugin to handle this.

@Coly010 Coly010 self-assigned this Feb 12, 2025
Copy link

vercel bot commented Feb 12, 2025

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

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Feb 17, 2025 10:34am

Copy link

nx-cloud bot commented Feb 12, 2025

View your CI Pipeline Execution ↗ for commit 6203d88.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 31m View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check --base= --he... ✅ Succeeded 6s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 4s View ↗
nx documentation ✅ Succeeded 2m 8s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-17 11:08:44 UTC

@Coly010 Coly010 force-pushed the mf/rspack-mf-plugin branch 3 times, most recently from 4d7a22f to 0174987 Compare February 14, 2025 13:06
@Coly010 Coly010 marked this pull request as ready for review February 14, 2025 14:25
@Coly010 Coly010 requested a review from a team as a code owner February 14, 2025 14:25
@Coly010 Coly010 requested a review from jaysoo February 14, 2025 14:25
// in addition to writing into the stdout stream, also show error directly in console
// so the error is easily discoverable. 'ERROR in' is the key word to search in webpack output.
if (stdoutString.includes('ERROR in')) {
console.log(stdoutString);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be logged via console.error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was copied from the existing build-static-remotes function that we have for executor usage. I think this is fine for now.

Copy link
Contributor

@ndcunningham ndcunningham Feb 14, 2025

Choose a reason for hiding this comment

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

Do you not think it is a better DX for errors to be logged via console.error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be a good opportunity to change it 🤔 @jaysoo you originally added this logic for handling errors - is there a reason you used console.log and not console.error?

Copy link
Contributor

@ndcunningham ndcunningham left a comment

Choose a reason for hiding this comment

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

It would be great to add some unit / e2e tests to be sure of its core functionality and prevent regressions down the line.

Copy link
Contributor

@ndcunningham ndcunningham left a comment

Choose a reason for hiding this comment

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

Approved as to not block it from being merged

@Coly010 Coly010 force-pushed the mf/rspack-mf-plugin branch from 0174987 to 6203d88 Compare February 17, 2025 10:31
@Coly010 Coly010 merged commit 090364a into master Feb 17, 2025
12 checks passed
@Coly010 Coly010 deleted the mf/rspack-mf-plugin branch February 17, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants