How to create a Micro Frontend bundle with Webpack that shares libraries with the container application?

前端 未结 2 1299
囚心锁ツ
囚心锁ツ 2021-02-09 01:31

I have a task.

To have Micro Frontends with single-spa framework.

  1. portal/main application (which load all other js code by url)
  2. Micro Frontend 1 (
2条回答
  •  滥情空心
    2021-02-09 02:17

    The best way to achieve this today is using Webpack's new Module Federation technology released in v5. This approach does not use SystemJS but rather the internals of Webpack. We tried several different micro frontend approaches, but this one outshines them all & is currently running successfully for us in production. There are definitely some challenges to setting it up but it was worth the developer productivity gains.

    Here is the info site produced by the creator Zack Jackson which should provide all the resources you need: https://module-federation.github.io/

    Here is the link to webpack docs which deal more with technicalities rather than how to practically set up a full micro frontend architecture: https://webpack.js.org/concepts/module-federation/

提交回复
热议问题