Tools and Practices for Microfrontends

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

内容简介:Today, Microfrontends are no longer a proof of concept. If we search on the internet, we can find many case studies of adopting Microfrontends. Besides, most of these web apps are already in production, proving its robustness.However, it is essential to fo

Tools and Practices for Microfrontends

Today, Microfrontends are no longer a proof of concept. If we search on the internet, we can find many case studies of adopting Microfrontends. Besides, most of these web apps are already in production, proving its robustness.

However, it is essential to follow the best practices and choose the right tools to succeed with Microfrontends. Otherwise, Microfrontends could quickly become an overhead for your teams, risking the overall growth of the project.

In this article, I’m going to share some of the best practices around Microfrontends and recommend several tools to establish these practices in your projects.

1. Code Structure and Components

When adopting Microfrontends, one of the critical decisions you have to make is to choose the approach used to structure the code.

The two conventional methods used out there are the Distributedrepo and the Monorepo. Other than these two are hybrid approaches that fall somewhere in between.

In the Distributedrepo approach, the Microfrontends are divided into multiple repositories with their lifecycle managed separately. In the Monorepo, all the Microfrontends will reside in a single repository.

Distributed Repo Approach

The Distributed Repo approach is the more flexible one but it has the great challenge of sharing UI components, to maintain a consistent UI across MFs (which usually means maintaining UI components as NPM libraries, which creates the overhead of maintaining different build pipelines, different repositories, and version mismatches).

One good example of both implementing this Micro Frontends approach and solving the problem of sharing UI components between them, can be seen in Bit.dev .

The Bit.dev marketing website is composed using two groups of React components published and managed by the Bit platform. The two groups were built and delivered separately. The “moment of integration” happens on build time, in a codebase that consumes components from both collections. Whenever a new component version is delivered, a new integration happens.

Hover over different components on Bit’s landing page to see each component’s “scope” or “collection”. Click on the component name (on top) to inspect the component and/or to install it in your project.

Tools and Practices for Microfrontends
Bit’s landing page composed of independent components

As mentioned earlier, the above page is built from components developed in two different codebases, on two different GitHub repositories. Components of each codebase are published to their respective Bit collections.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

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

Linux命令行与shell脚本编程大全 第3版

Linux命令行与shell脚本编程大全 第3版

[美]布鲁姆,布雷斯纳汉 / 门佳、武海峰 / 人民邮电出版社 / 2016-8-1 / CNY 109.00

这是一本关于Linux命令行与shell脚本编程的全方位教程,主要包括四大部分:Linux命令行,shell脚本编程基础,高级shell脚本编程,如何创建实用的shell脚本。本书针对Linux系统的最新特性进行了全面更新,不仅涵盖了详尽的动手教程和现实世界中的实用信息,还提供了与所学内容相关的参考信息和背景资料。通过本书的学习,你将轻松写出自己的shell脚本。一起来看看 《Linux命令行与shell脚本编程大全 第3版》 这本书的介绍吧!

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

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具