我正在建立一个网站,在那里我会使用不同的聚合物组件,其中一些是多次。
我的问题是编译的代码包含
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
我不知道如何解决这个问题。
答案 0 :(得分:2)
如果在两个不同的组件中使用两个不同的路径包含聚合物,它们都会被执行,并且都试图定义dom-module,dom-if等。
因此,请检查网络面板中是否有相同的文件名但路径不同。
示例:
/bower_components/webcomponentsjs/webcomponents-loader.js
and
/components/webcomponentsjs/webcomponents-loader.js