-
-
Notifications
You must be signed in to change notification settings - Fork 235
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: recursive search for shared version #2681
base: main
Are you sure you want to change the base?
feat: recursive search for shared version #2681
Conversation
🦋 Changeset detectedLatest commit: e36fd74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 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 failed. Why did it fail? →
|
5b9a3ac
to
6d7a50b
Compare
I will have to see about backporting this to rspack first before i can consider merge, will follow up |
No problem, let me know if you need any more info/context |
no, it makes sense. Just need to look at the rust end and sync the implementation |
cb92225
to
79b38b5
Compare
79b38b5
to
a4c6d41
Compare
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.
Summary
This pull request introduces a significant enhancement to the @module-federation/enhanced
package by enabling recursive searching for the version of shared modules. This functionality is particularly beneficial for monorepo setups where dependencies are often defined in the root package.json
, rather than in individual application directories.
Key changes include:
- Implemented logic to traverse parent directories to locate the version of a shared module when it is not specified in the closest
package.json
. - Improved compatibility with monorepo structures, allowing for seamless integration of shared dependencies across multiple applications.
- Added error handling to provide warnings when the required version cannot be determined, enhancing the robustness of the module.
- Comprehensive tests have been added to ensure the reliability of the new feature, with all existing tests passing successfully.
Overall, these changes enhance the functionality of the module federation setup, making it more adaptable to complex project structures while maintaining a user-friendly experience.
File Summaries
File | Summary |
---|---|
packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts | Enhancements have been made to enable recursive searching for the version of a shared module when it is not specified in the nearest package.json . The changes primarily involve modifying the logic to traverse parent directories until the required version is found, improving compatibility with monorepo structures where dependencies may be defined at the root level. This update also includes error handling to ensure that appropriate warnings are issued when the version cannot be determined. |
Issues Reviewed:
Issue | Result | Reason |
---|---|---|
2680 | ✅ | The pull request addresses the issue of resolving shared dependency versions in a monorepo setup, as described in the associated issue. |
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.
Incremental Review
Comments posted: 0
Configuration
Squadron Mode: essential
Commits Reviewed
13861194dc80ea7ea416d3bd9fe45dc348ef9d97...a4c6d417937f7d93dcce1eaaa832b0cf47f47a5f
Files Reviewed
- packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/lucky-fans-exist.md
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/lib4/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/lib4/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/lib5/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/store/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/store/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/relative1.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/relative2.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib1/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib1/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib2/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib3/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib3/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/webpack.config.js
a4c6d41
to
e36fd74
Compare
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.
Incremental Review
Comments posted: 6
Configuration
Squadron Mode: essential
Commits Reviewed
13975e1793d1e1eda4b3aed0ed919fddcff02aaf...e36fd749db46438c4097ab3b54130a6514109157
Files Reviewed
- packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/lucky-fans-exist.md
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/lib4/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/lib4/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/lib5/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/store/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/node_modules/store/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/relative1.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/app1/relative2.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib1/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib1/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib2/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib3/index.js
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/node_modules/lib3/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/package.json
- packages/enhanced/test/configCases/sharing/share-plugin-monorepo/webpack.config.js
Description
Allows
@module-federation/enhanced
to recursively search for the version of a shared module when it is not defined in it's closestpackage.json
. A common pattern for monorepos is to have dependencies installed in the rootpackage.json
.Related Issue
#2680
Types of changes
Checklist