我正在构建一个网站,我会在其中使用不同的聚合物组件,其中一些组件会多次使用。
我的问题是编译后的代码包含一个
customElements.define('dom-module', DomModule);
那个抛出
Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry at CustomElementRegistry.value
我不知道如何解决这个问题。
如果您在两个不同的组件中使用两个不同的路径包含聚合物,则它们都会被执行,并且都尝试定义 dom-module、dom-if 等。
因此,请检查网络面板是否有相同的文件名但不同的路径。
Example:
/bower_components/webcomponentsjs/webcomponents-loader.js
and
/components/webcomponentsjs/webcomponents-loader.js
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)