From the original gold digger 《 What exactly is a micro front end , What benefits can it bring 》
This article will explain the background of the birth of micro front end , Explain in detail the reason of the concept of micro front end and its in-depth understanding , After reading this article , I believe you have a comprehensive understanding of the micro front end , Understand what problems it can solve for your team and the entire enterprise , What's the payoff .
One . background
Now many enterprises , Basically, the application code is isolated physically , Implement a single application, a single library , Closed loop deployment updates test environment 、 Pre release environment and formal environment . therefore , What we're talking about is , Based on different applications, different libraries and independent deployment , How to realize resource sharing among multiple applications ？
In the past, a lot of processing methods were npm Package form extraction and reference , For example, between multiple application projects , There may be a business logic module or something else that is reusable , He pulled it out to npm Management and use of packages in the form of . But this has brought about the following problems ：
- Publishing is inefficient . If you need to iterate npm The logical business within the package , It needs to be released first npm After the package , Every time you use it npm Package applications are updated once npm Package version , Build and release each other again , The process is tedious . If there are more applications involved , It takes more manpower and energy .
- Multi team cooperation is easy to be irregular . Containing general modules npm Packages as shared assets ,“ everyone ” Have it , But in practice , This usually means that no one owns it . It will soon be full of cluttered code with inconsistent styles , There is no clear agreement or technical vision .
These questions make us realize , Expanding the scale of front-end development so that multiple teams can develop a large and complex product at the same time is an important but difficult problem .
therefore , As early as 2016 year , The concept of micro front end was born .
Two . Micro front end concept
Micro Frontends The official website defines the concept of micro front end ：
Techniques, strategies and recipes for building a modern web app with multiple teams that can ship features independently.
Translate into Chinese ：
from Micro Frontends You can learn from the official website that , The concept of micro front end is extended from the concept of micro service , Abandon the large monomer approach , Decompose the whole front end into small and simple blocks , These blocks can be developed independently 、 Testing and deployment , At the same time, it still converges into a product that appears in front of customers . It can be understood that micro front end is an architectural style that integrates multiple small front-end applications that can be delivered independently into a whole .
There are several points worth noting ：
- Micro front end is not a specific technology , It's about Integrating Technology 、 Strategies and methods , Maybe with scaffolding 、 Auxiliary plug-ins and specification constraints are displayed in this form of ecosystem , It's a macro framework . There are many solutions to this architecture , Both have advantages and disadvantages , But as long as the application of the current business scenario is a good solution .
- Micro front end has no technology stack constraints . The design of each micro front end solution , It's all based on actual needs . If it's used by multiple teams react Technology stack , There may be no requirement for cross technology stack usage of micro front end solutions ; If multiple teams use it at the same time react and vue Technology stack , It may have higher requirements on the cross technology stack of micro front end .
3、 ... and . Advantages of micro front end
Contrast npm Bag mode pull away , Let's realize the importance of updating processes and efficiency . Micro front end is the aggregation of multiple sub applications , If multiple business applications depend on the function module of the same service application , Just update the service application , Other business applications can be updated immediately , This shortens the update process and saves the update cost .
Because of the burden of history , Some teams still exist .........