-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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): use proxy servers to proxy to single file server for static remotes #26782
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit e3dcd49. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 5 targets
Sent with 💌 from NxCloud. |
c576e10
to
ba829f4
Compare
7b2d218
to
d7bba68
Compare
d7bba68
to
f22d782
Compare
700a473
to
69666a8
Compare
69666a8
to
d616f59
Compare
d616f59
to
914edbc
Compare
914edbc
to
c48d7e2
Compare
c48d7e2
to
e49f239
Compare
e49f239
to
a9be846
Compare
a9be846
to
1f1a2b3
Compare
1f1a2b3
to
89f08ae
Compare
@@ -39,7 +40,6 @@ export async function* moduleFederationDevServerExecutor( | |||
// Force Node to resolve to look for the nx binary that is inside node_modules | |||
const nxBin = require.resolve('nx/bin/nx'); | |||
const options = normalizeOptions(schema); | |||
options.staticRemotesPort ??= options.port + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this because it needs to be defaulted from the results of getRemotes
(just like in React). Otherwise there could be a port conflict if one of the dev remotes has a port that's host port + 1.
89f08ae
to
3667681
Compare
3667681
to
08681b1
Compare
…rver for static remotes
08681b1
to
dc622b9
Compare
7b78039
to
e4bf406
Compare
e4bf406
to
e3dcd49
Compare
Hi @Coly010, thanks a lot for this fix. Is there a documentation that I can look into understand how this works? |
…rver for static remotes (#26782) <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> Remotes that are served for a host are usually served from a single file server running on a single port. We perform some mapping logic during the build of the host application to update the locations the remotes can be found at to point to the single file server. This works, but it's also wrong, as it breaks the flow that users expect. It also breaks dynamic remotes. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> Continue to serve the remotes from a single file server, as this helps reduce the amount of resources used on developers machines. Use express to create proxy servers that will proxy requests from the original remote location to the single file server. This allows applications to continue to work without us having to interfere and map any remote locations. It also solves the issue with dynamic remotes. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #26318 (cherry picked from commit a549b9b)
@VanTigranyan No documentation as of yet, but it is coming. Essentially, the process is now
This means we continue to get the machine resource savings without doing any under the hood mapping of remote locations etc. |
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. |
Current Behavior
Remotes that are served for a host are usually served from a single file server running on a single port.
We perform some mapping logic during the build of the host application to update the locations the remotes can be found at to point to the single file server.
This works, but it's also wrong, as it breaks the flow that users expect.
It also breaks dynamic remotes.
Expected Behavior
Continue to serve the remotes from a single file server, as this helps reduce the amount of resources used on developers machines.
Use express to create proxy servers that will proxy requests from the original remote location to the single file server.
This allows applications to continue to work without us having to interfere and map any remote locations.
It also solves the issue with dynamic remotes.
Related Issue(s)
Fixes #26318