Webpack 5: Module Federation. A Game-changer to Javascript architecture.

栏目: IT技术 · 发布时间: 4年前

内容简介:Module federation — The Javascript equivalent of what Apollo did with GraphQL. Multiple Webpack builds work together, sharing the dependency graph at runtime. Multiple bundles can share both modules and components from the codebase as well as node_modules.

Module federation — The Javascript equivalent of what Apollo did with GraphQL. Multiple Webpack builds work together, sharing the dependency graph at runtime. Multiple bundles can share both modules and components from the codebase as well as node_modules. Painless orchestration at runtime. Feels just like a SPA

Until now, a scalable solution to sharing code between independent applications has never been convenient, barley possible. The closest we had was externals or dll plugin, forcing centralized dependency on a external file. It was also a hassle to share code, the separate applications were not truly standalone and usually a limited number of dependencies are shared. Moreover, sharing actual feature code or components between seperately bundled applications is even harder… until now

We need a scalable solution to sharing node modules and feature/application code. It needs to happen at runtime. Externals just doesn’t do an efficient or flexible job. Import maps do not solve the scale problem. I’m not trying to just download code and share dependencies. I’m trying to create an orchestration layer that dynamically shares modules are runtime, with fallbacks and redundancies.

What is Module Federation?

Webpack 5: Module Federation. A Game-changer to Javascript architecture.

It’s a type of JavaScript architecture I invented and prototyped. Then with the help of my co-creator and the founder of webpack — it was turned into one of the most exciting features in the Webpack 5 core (there’s some cool stuff in there, and the new API is really powerful and clean).

Module federation allows a JavaScript application to dynamically load code from another application — in the process, sharing dependencies, if an application consuming a federated module does not have a dependency needed by the federated code — webpack will download the missing dependency from that federated build origin.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Kotlin实战

Kotlin实战

【美】Dmitry Jemerov(德米特里·詹莫瑞福)、【美】 Svetlana Isakova(斯维特拉娜·伊凡诺沃) / 覃宇、罗丽、李思阳、蒋扬海 / 电子工业出版社 / 2017-8 / 89.00

《Kotlin 实战》将从语言的基本特性开始,逐渐覆盖其更多的高级特性,尤其注重讲解如何将 Koltin 集成到已有 Java 工程实践及其背后的原理。本书分为两个部分。第一部分讲解如何开始使用 Kotlin 现有的库和API,包括基本语法、扩展函数和扩展属性、数据类和伴生对象、lambda 表达式,以及数据类型系统(着重讲解了可空性和集合的概念)。第二部分教你如何使用 Kotlin 构建自己的 ......一起来看看 《Kotlin实战》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具