Document webpack change: feat: add URL dependencies support to consume shared module via module federation
A pull request by @snitin315 was merged and maintainers requested a documentation change.
See pull request: https://github.com/webpack/webpack/pull/16945
Fixes https://github.com/webpack/webpack/pull/14035
For module federation shared, without
requiredVersionconfigured, it will infer the version based on package.json, as we can see in ConsumeSharedPlugin.js.But when we get
requiredVersionfrompackage.json, it just gets dep/dev /peer/optional dependencies value, without consideration of some URL Dependencies cases.For example,
"isarray": "git+https://github.com/juliangruber/isarray.git#v2.0.3", it's real version should bev2.0.3, but we can not get that.
Summary
🤖 Generated by Copilot at fb959e1
This pull request adds support for git urls as dependencies in shared modules. It implements a new function normalizeVersion to handle git urls in lib/sharing/utils.js and adds more tests and dependencies to the test/configCases/sharing/consume-multiple-versions folder to verify the feature. It also updates the cspell.json file to ignore the word "commithash".
Details
🤖 Generated by Copilot at fb959e1
- Add
normalizeVersionfunction tolib/sharing/utils.jsto normalize the version of a shared module from a git url (link) - Use
normalizeVersionfunction on the optional, dependencies, peer dependencies, and dev dependencies of a shared module ingetRequiredVersionfunction inlib/sharing/utils.jsto ensure consistent version resolution (link, link, link, link) - Add
commithashto the cspell ignore list incspell.jsonto avoid spelling errors in the code that deals with git commit hashes (link) - Add more shared modules with different versions and git urls as dependencies to the
test/configCases/sharing/consume-multiple-versionstest case to test the new feature of allowing git urls as dependencies in the package.json of a shared module (link, link, link) - Add more expectations to the
test/configCases/sharing/consume-multiple-versions/index.jsfile to check the versions of the shared modules that are required by the host module (link)