如何更新一个Polymer组件的依赖关系而又不更新另一个的依赖关系? [英] How to update dependencies of one Polymer component without updating those of another?
问题描述
我将尽力描述我们的特定问题,以避免遇到XY问题.
I'll try to describe our specific problem to avoid running into an XY Problem.
我们有一个Polymer应用程序,其中包含几个独立的组件(由不同的团队维护).这些组件中的每个组件都依赖于Bower管理的其他组件.
We have one Polymer app, that consists of several independent components (maintained by different teams). Each of these components has dependencies on other components, managed by Bower.
有时,不同的组件(例如A和B)对相同的组件(例如C)具有依赖性.现在,当C发布具有重大更改的新版本时,A和B都必须同时 升级到该新版本.
Sometimes, different components (say, A and B) have dependencies on the same components (e.g. C). Now when C releases a new version with a breaking change, both A and B have to upgrade to that new version at the same time.
一旦组件数量增加(对于我们来说,这很快),就变得不受欢迎了.因此,我们想知道是否有一种方法可以分别更新每个组件的依赖关系.
This quickly becomes undesirable once the number of components grows (as it has for us). Thus, we're wondering if there's a way to update each component's dependencies individually.
我们正在使用聚合物构建并硫化(如果相关).
We're using polymer-build and vulcanize, if that's relevant.
推荐答案
您的单个元素可以具有不同的依赖性,但是您的应用程序只能具有某个元素的一个版本.
Your individual elements can have different dependencies but your app can have only one version of a certain element.
其背后的原因是,您只能使用document.registerElement
(该聚合物内部使用)注册一次特定的名称/元素,而我认为没有任何方法可以注销元素.
The reason behind this is you can register a certain name/element only once using document.registerElement
(which polymer uses internally) and i don't think there is any way to de-register an element.
在您的应用中,您可以通过添加分辨率来控制元素的版本..
In your app you can control the version of elements by adding resolution.
这篇关于如何更新一个Polymer组件的依赖关系而又不更新另一个的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!