Skip to content

Conversation

ScriptedAlchemy
Copy link
Member

Summary

  • Add alias-aware matching to ProvideSharedPlugin and ConsumeSharedPlugin so aliased imports (e.g., reactnext/dist/compiled/react) are recognized as shared when only the target is in shared config
  • Add comprehensive test coverage including new config test case and unit tests for alias-aware behavior

Changes

  • ProvideSharedPlugin: Add Stage 3 to compare resolved module's node_modules suffix against provided requests, respecting layer and filter rules
  • ConsumeSharedPlugin: Add Stage 6 to resolve aliased requests against shared config using webpack's resolver
  • Tests: New share-with-aliases-provide-only config test case and focused unit test for provide-only alias-aware behavior
  • Utilities: Add aliasResolver.ts for extracting node_modules paths and path normalization

This enhancement enables Module Federation to work seamlessly with bundler alias configurations (Next.js, Webpack aliases, etc.) without requiring manual workarounds.

…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.
…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
Copy link

changeset-bot bot commented Sep 8, 2025

⚠️ No Changeset found

Latest commit: 180e9bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Sep 8, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 180e9bf
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/68c3b791c2076200084e40f9
😎 Deploy Preview https://deploy-preview-4049--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant