Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Federated Module using Webpack 4.X

Does Webpack 4.X versions provide Module Federation ? if so, is the implementation different from the way we do it on Webpack 5?

like image 358
Henock Asmelash Avatar asked Oct 19 '25 10:10

Henock Asmelash


2 Answers

Webpack 4 does not currently support module federation.

In the Micro Frontends Slack group, there is mention that the author of Webpack module federation has discussed back porting it to Webpack 4 but I haven't found any evidence to suggest that or mention progress.

Update: Here is the Github issue where he mentions backporting it, though he doesn't discuss it after that.

like image 89
Brady Dowling Avatar answered Oct 22 '25 03:10

Brady Dowling


I have tried this one: https://github.com/module-federation/webpack-4. For me, it did work fine in "development" mode on a SPA container project created for webpack 4.47.0, it did load other federated modules created with more modern CLI's for webpack 5. The only problem, which is a major show stopper for me, is that I cannot do "production" build, it gives me some webpack plugin issues :'(

Update: The "production" build issue can be solved by disabling parallelization of the build process. For me it was "parallel: false" flag in vue.config.js file.

So overall it is the only solution I found that can enable to upgrade step by step a huge legacy project based on webpack 4. Sometimes upgrading webpack 4 to webpack 5 is just simply not feasible.

like image 29
Mikser Avatar answered Oct 22 '25 04:10

Mikser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!