[英]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.