-
-
Notifications
You must be signed in to change notification settings - Fork 310
feat(modern-js-plugin): add server plugin to handle remote's SSR assets #3777
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
Merged
2heal1
merged 3 commits into
module-federation:main
from
zllkjc:feat/modern-server-plugin
May 27, 2025
Merged
feat(modern-js-plugin): add server plugin to handle remote's SSR assets #3777
2heal1
merged 3 commits into
module-federation:main
from
zllkjc:feat/modern-server-plugin
May 27, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 8cb01eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
af08207
to
e2368d8
Compare
chore: add static file cache chore: update modernjs version chore: add unit test for static middleware chore: imporve pathname logic
2c49770
to
ed5b57e
Compare
2heal1
approved these changes
May 26, 2025
Merged
This was referenced May 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR optimizes the use of MF & Modern.js SSR.
For security reasons, the Modern.js server by default only hosts files in the
dist/static
directory.!6924While
@module-federation/modern-js
places SSR output in thebundles/
directory, just like Modern.js SSR output. Therefore, in the past, when deploying to production, developers needed to copy the MF SSR output to the static resource directory and upload it to CDN, otherwise consumers couldn't access the producer.But in our practice, we found that many developers don't use CDN, but use Modern.js deployment to generate products which can run in Node.js. And developers also can't mock the production environment locally by using Modern.js
build
+serve
commands.Now the
@module-federation/modern-js
also provides a server-side plugin for Modern.js, used to host the MF SSR output. Devs only need to run the Modern.js server to access the MF SSR output, whether through Modern.js deployment or when mock the production environment locally.In this PR, I also upgraded the version of Modern.js. We need to use this feature in versions after 2.67.6.
In addition, I use
fs-extra
instead of@modern-js/utils
, the latter is more like an internal package, and it is not recommended to use it in MF plugin.ps: If have any questions, feel free to submit an Issue for Modern.js or communicate under this PR.
Related Issue
Types of changes
Checklist