Skip to Content
微前端设计与实现
book

微前端设计与实现

by Luca Mezzalira
August 2022
Beginner to intermediate
270 pages
7h 38m
Chinese
Posts & Telecom Press
Content preview from 微前端设计与实现
微前端技术实现
97
因为以上原因,团队在项目中选择了
Module Federation
,但
Module Federation
不是万能的。当
设计架构时,我们不能盲目,需要权衡利弊再做出选择。在决定使用哪种微前端架构之前,
需要分析团队结构、开发人员掌握的技能、公司在以往的项目中使用的技术栈以及项目的业
务目标。在分析了实际工作场景后,使用微前端决策框架为项目的发展打下坚实的基础。
5.2
 
Module Federation
入门
在开始技术实现之前,我们需要了解一些基本概念以理解一些技术决策背后的原理。
Module Federation
允许
JavaScript
应用程序动态运行来自另一个捆绑包的代码
,或是在客户
端和服务器上构建代码。
Module Federation
是一个插
件,可用于
webpack 5
,也可以用于功
能有限的
webpack 4
Rollup
1
。在使用
Module Federation
之前必须了解以下两个重要概念。
host
在运行时加载共享库、微前端或组件的容器。
remote
我们要在本地加载的
JavaScript
代码包。
如图
5-2
所示
,一个
host
可以加载多个
remote
。在本书的案例中,
host
代表了
App shell
remote
代表其中的一个微前端。
remote
host
remote
remote remote
5-2Module Federation 由两个关键元素组成:host 负责在运行时加载一些 JavaScript 捆绑包;
remote 代表任何类型的 JavaScript ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python语言及其应用(第2版)

Python语言及其应用(第2版)

Bill Lubanovic

Publisher Resources

ISBN: 9787115595089