webpack.js.org icon indicating copy to clipboard operation
webpack.js.org copied to clipboard

Document webpack change: feat: add URL dependencies support to consume shared module via module federation

Open webpack-bot opened this issue 2 years ago • 0 comments

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 requiredVersion configured, it will infer the version based on package.json, as we can see in ConsumeSharedPlugin.js.

But when we get requiredVersion from package.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 be v2.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 normalizeVersion function to lib/sharing/utils.js to normalize the version of a shared module from a git url (link)
  • Use normalizeVersion function on the optional, dependencies, peer dependencies, and dev dependencies of a shared module in getRequiredVersion function in lib/sharing/utils.js to ensure consistent version resolution (link, link, link, link)
  • Add commithash to the cspell ignore list in cspell.json to 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-versions test 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.js file to check the versions of the shared modules that are required by the host module (link)

webpack-bot avatar May 03 '23 16:05 webpack-bot