-
-
Notifications
You must be signed in to change notification settings - Fork 358
feat(enhanced): add alias-aware providing and consuming for shared modules #4049
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
base: main
Are you sure you want to change the base?
Conversation
…shared modules - Add opencode.json with alias-resolver agent for fixing webpack alias issues - Add comprehensive prompt documentation for Module Federation alias resolution - Add failing test case demonstrating shared module alias bug - Add AGENTS.md with repository guidelines and commands
- Add alias resolution support for shared modules - Relax strict instance matching to package identity checks - Implement version inference from module source - Add caching for consume shared modules - Update test expectations for alias sharing
… provide hook - ConsumeSharedPlugin: simplify factorize flow (no behavior change) - Rename nodeModulesReconstructedLookup to allowNodeModulesSuffixMatch - ProvideSharedPlugin: add helpers for layer checks and prefix matches - Mark alias resolver docs out of scope BREAKING CHANGE: option renamed to allowNodeModulesSuffixMatch
- Use descriptionFileData to build candidates (pkgName/relative path) - Match candidates in consume and provide hooks - Keep behavior/gating for suffix/prefix matching
This reverts commit 667a941.
This reverts commit 5a67bc8.
…Factory; update docs" This reverts commit 42a9b47.
…dules - Add Stage 3 in ProvideSharedPlugin to recognize aliased imports when only target is shared - Add Stage 6 in ConsumeSharedPlugin to resolve aliased requests against shared config - Add aliasResolver utility for extracting node_modules paths - Add provide-only config test case and unit test for alias-aware behavior - Clean up existing alias test assertions - Update .gitignore to include test mock node_modules
🦋 Changeset detectedLatest commit: 978dc15 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 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. |
…only Adds the required node_modules/next/dist/compiled/react/index.js stub that the alias points to, fixing the failing config case test.
Apply suggested changes
…registers tests immediately
# Conflicts: # packages/enhanced/test/unit/sharing/ConsumeSharedPlugin.improved.test.ts
…re into feat/share-resolver
@codex review pr |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
request: options.request || options.import || key, | ||
exclude: options.exclude, | ||
include: options.include, | ||
nodeModulesReconstructedLookup: | ||
options.nodeModulesReconstructedLookup, | ||
allowNodeModulesSuffixMatch: options.allowNodeModulesSuffixMatch, | ||
}, |
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.
Preserve legacy nodeModulesReconstructedLookup option
The constructors for SharePlugin
and ConsumeSharedPlugin
now only read allowNodeModulesSuffixMatch
and the schema removed nodeModulesReconstructedLookup
. Existing configurations that still use the prior key (including experiments.nodeModulesReconstructedLookup
) will silently lose the suffix‑matching behaviour after upgrading, even though nothing in the release notes indicates a breaking change. Consider accepting both property names or providing a migration path so current users don’t regress when they upgrade.
Useful? React with 👍 / 👎.
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.
we dont want to preserve legacy
# Conflicts: # .gitignore # packages/enhanced/test/unit/sharing/ConsumeSharedPlugin/ConsumeSharedPlugin.createConsumeSharedModule.test.ts # packages/enhanced/test/unit/sharing/ConsumeSharedPlugin/ConsumeSharedPlugin.exclude-filtering.test.ts # packages/enhanced/test/unit/sharing/SharePlugin.improved.test.ts # packages/enhanced/test/unit/sharing/resolveMatchedConfigs.test.ts
# Conflicts: # tools/scripts/run-manifest-e2e.mjs
# Conflicts: # packages/enhanced/test/unit/sharing/ConsumeSharedPlugin/ConsumeSharedPlugin.integration.test.ts # packages/enhanced/test/unit/sharing/ConsumeSharedPlugin/helpers.ts
Summary
react
→next/dist/compiled/react
) are recognized as shared when only the target is in shared configChanges
share-with-aliases-provide-only
config test case and focused unit test for provide-only alias-aware behavioraliasResolver.ts
for extracting node_modules paths and path normalizationThis enhancement enables Module Federation to work seamlessly with bundler alias configurations (Next.js, Webpack aliases, etc.) without requiring manual workarounds.