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

微前端设计与实现

by Luca Mezzalira
August 2022
Beginner to intermediate
270 pages
7h 38m
Chinese
Posts & Telecom Press
Content preview from 微前端设计与实现
86
4
这种架构的痛点在于使用
Redux
管理全局状态,以便在微前端之间共享应用的状态。如前
所述,每个微前端都应该是完全独立的,但在
Holocron
中并非如此
,需要自定义事件用于
微前端之间的通信。虽然这不是
React
应用中最常用的通信技术
,但它确实离完全接受微
前端原则又近了一步。由于
Holocron
模块可以存储在任何地方
,不需要从虚拟的
CDN
获取,因此虚拟机、对象存储或容器也可能是合适的解决方案。
OpenComponents
是另一个用于服务器端横向拆分架构的微前端框架
。该框架提供了几个
开箱即用的功能,包括通过运行时代理预热
CDN
,微前端注册表和简化开发体验的工具
每个微前端都被封装在一个计算层内,该计算层与其他层完全隔离。这种方法使每个团队
能够专注于所负责领域的实现,而不用考虑整个应用。此外,每个微前端都有一套实用工
具,提供观察和监控能力以及数据概览页。为了管理一天中特定时间的突发流量(比如来
自餐厅预订餐桌的持续流量),每次创建新的微前端或对现有的微前端进行更改时,都会
将正在使用的
CDN
流量进行清理或者刷新预热(图
4-26
)。
微前端
A
微前端
B
微前端
C
注册OpenComponents
CDN
OpenComponents
运行时代理
4-26OpenComponents 架构展示了服务器端渲染的微前端是如何投入使用的
有趣的是,由于
OpenComponents
不仅允许服务器端渲染,而且允许客户端渲染,因此
你可以为每个用例选择合适的技术。比如,当
SEO
是一个项目的关键目标时
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