简体   繁体   English

如何在微前端中的 2 个应用程序与 webpack 模块联合(角度)之间建立关系

[英]how can I relation between 2 app in micro frontend with webpack module federation (angular)

hi there assume that we have a library and an app in angular and we want show a component from library in modal in our app the solution is here we install our library in our app as dependency in (package.json) but my question is If our architecture is micro frontend we have 2 app instead library imagine that we want to show a component from app1 in a modal in our app2 How can we access to component from app2?嗨,假设我们在 angular 中有一个库和一个应用程序,我们想在我们的应用程序中以模态显示库中的一个组件,解决方案在这里我们将我们的库作为依赖项安装在我们的应用程序中(package.json),但我的问题是如果我们的架构是微前端 我们有 2 个应用程序而不是库 想象我们想在我们的 app2 中以模态显示来自 app1 的组件 我们如何从 app2 访问组件? (components are in app1) (组件在 app1 中)

Do I understand it right?我理解对了吗? You want to use a component in app 2 that is in app 1 ?您想在app 2中使用app 1中的组件吗?

If so, then I think you're doing it wrong.如果是这样,那么我认为你做错了。 If you need a component in both apps you shouldn't create it in one of your apps.如果您在两个应用程序中都需要一个组件,则不应在其中一个应用程序中创建它。 You may create a shared library that holds all common things between your apps and then install that library as a package in each app individually.您可以创建一个共享库来保存您的应用程序之间的所有常见内容,然后将该库作为 package 单独安装在每个应用程序中。

#UPDATE: #更新:

Take a look here , it may help you find a better design.看看这里,它可能会帮助您找到更好的设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Angular CLI 创建一个新的遥控器? (Webpack 5 Module Federation 微前端) - How to create a new remote using Angular CLI? (Webpack 5 Module Federation micro frontends) 如何在 IIS 上使用 webpack5 模块联合部署 angular 应用程序? - How to deploy angular app using webpack5 module federation on IIS? Webpack 5 Module Federation 微前端和 Nx monorepos 是否相互排斥? - Are Webpack 5 Module Federation micro frontends and Nx monorepos mutually exclusive? 在与 angular 联合的 webpack 上加载了错误的模块 - Wrong module loaded on webpack federation with angular 如何在 Module Federation 的 Angular 中创建我的服务的单个实例? - How can I create a single instance of my service in Angular, in Module Federation? Angular MFE - WebPack5 - 模块联合 - I18N 翻译 - Angular MFE - WebPack5 - Module Federation - I18N translations Angular 未使用 Angular 模块联合创建的块文件 Webpack - Angular chunk files not created with Angular Module Federation Webpack Angular azure 应用服务上的模块联盟 - Angular module federation on azure app service 如何在 Angular 中实现微前端(Iframe 的替代方案) - How to Implement Micro Frontend in Angular (Alternative to Iframe) Angular mat-select 和 webpack 模块联合事件问题 - Angular mat-select and webpack module federation event problem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM