是否可以在一页上运行具有不同角度版本的多个应用程序? [英] Is it possible to run multiple apps with different angular versions on one page?

查看:65
本文介绍了是否可以在一页上运行具有不同角度版本的多个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一页上运行多个angular2应用程序.此外,它们应在不同版本中运行.

I want to run multiple angular2 applications on one page. Additionally they should run in different versions.

我知道:Angular被设计为一个单页应用程序框架,因此我描述的用例非常奇怪.尽管如此,我想知道理论上是否可行?

I know: Angular is designed to be a single page application framework and so the use case I described is pretty exotic. Nevertheless I want to know if it is theoretically possible?

我已经设法使其运行,我唯一的问题是,zone-js在全局名称空间上具有一个变量,并且在多次加载时抛出错误.当我仅加载一次zone-js时,两个有角度的应用程序并排运行.您可以在dom中看到不同的角度版本.

I've already managed to get it run, my only problem was, that zone-js has a variable on the global namespace and throws an error when getting loaded more than once. When I load zone-js only once, the two angular applications run side-by-side. You can see the different angular versions in the dom.

但现在我的问题更加详细:在一页上并排运行两个有角度的应用程序时,我是否需要担心?仅加载一次其他依赖项有意义吗?当有角度的主要版本4取决于另一个zone-js主要版本时,怎么办?我无法将它们都加载到一页上?是否可以两次加载所有webpack捆绑包(inline.bundle.js,vendor.bundle.js,main.bundle.js)?

But now my question(s) in more detail: Do I have to worry when running two angular applications running side-by-side on one page? Does it make sense to load other dependencies only once? What when maybe angular major version 4 depend on another zone-js major version - I can't load them both on one page? Is it OK to load all webpack bundles twice (inline.bundle.js, vendor.bundle.js, main.bundle.js)?

推荐答案

我们正在尝试解决类似的问题,并且发现了元框架实际上,我们能够毫不费力地引入由不同团队使用不同JS框架构建的其他SPA.

We are trying to solve a similar problem and we found a meta-framework that we found satisfactorily manages micro front end (SPAs) In fact, we were able to bring in other SPAs that were built by different teams with different JS frameworks with little to no effort.

可能有很多反对这样做的理由,因为这样的应用可能并不完全称为性能.我要说的是,在我们的案例中进行这种事情的原因是需要联合开发:我们有许多小型团队,它们不位于同一地点并且没有独立性,就交付时间表而言,它们有助于我们早先建立在庞大的app上.net平台作为整体MV * Webapp.

There may be a lot of reasons against doing this as such an app may not exactly be referred to as performant. I would say the reason for undertaking such a thing in our case was need for federated development: we have lots of small teams not which are not co-located and independent as far as delivery timelines that contribute to our gargantuan app which was earlier built on .net platform as a monolithic MV* webapp.

这篇关于是否可以在一页上运行具有不同角度版本的多个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆