DEV Community

Discussion on: Migrating CRA to Micro Frontends with Single SPA

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Impressive! I really like the example application you've been using to explain the concepts of Micro Frontends.

Now I've got a question. If each micro app is a fully fledged SPA then each micro app has a full set of its JS dependencies packaged via webpack that the browser needs to load. So in your example with a root project + episodes project + locations project we end up with 3 big JS packages, right?

=> Can we wrangle the JS packages through a deduplication pipeline or something alike so that we end up with just a single JS package?

Collapse
 
ogzhanolguncu profile image
Oğuzhan Olguncu

Thank you. We can actually make them share the same dependencies we want through Webpack config and, of course, we need to add those dependencies to index.ejs. In the end, all those apps are getting rendered in a container. In theory, If we add common dependencies to the container and delete them from each app that would reduce the final bundle size.

But I guess that alone would not help you reduce the JS bundle of each app. All those Micro Frontends concepts and libraries are fairly young, maybe in the future people will come up with better solutions.
Let me know if you have further questions. Cheers!