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

Document webpack change: advanced configs for container plugins

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

A pull request by @sokra was merged and maintainers requested a documentation change.

See pull request: https://github.com/webpack/webpack/pull/10893


  • refactor options parsing to allow advanced config options
    • automatic scoping has been removed and a scope method is offered instead
  • move shared schema definitions into a shared schema to allow to sync them
  • allow to pass multiple modules to a single exposed name
    • they are all executed and the last one is exported
  • allow to pass multiple container locations to remotes
    • they are tried in order, falling back to the next one when one fails
  • allow remotes to be promises as preparation of async externals

What kind of change does this PR introduce? refactor

Did you add tests for your changes? yes

Does this PR introduce a breaking change? yes, nested options has been removed

What needs to be documented once your changes are merged?

  • passing multiple modules to exposes like exposes: { abc: ["./a", "./b"] } will execute both on request and export the last one.
    • This could be used to initialization logic
    • All modules are placed in the async chunk
  • passing multiple externals to remotes like remotes: { abc: ["ABC", "DEF" } will try them in order until one of them is truthy.
    • This can be used for fallbacks or alternative locations
  • remotes can be Promises which will be awaited during chunk loading.
    • remotes: { abc: "import('https://example.com/abc.mjs')" }
  • ModuleFederationPlugin has overrides and overridables option

webpack-bot avatar May 16 '20 12:05 webpack-bot