Polymer DomModule already defined

懵懂的女人 提交于 2019-12-01 18:42:50

问题


I'm building a website, where I'd use different polymer components, some of them multiple times.

My problem is that the compiled code contains a

 customElements.define('dom-module', DomModule); 

that throws

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry at CustomElementRegistry.value

I have no idea how to resolve this.


回答1:


If you include polymer using two different paths in two different components, both of them gets executed and both tries to define dom-module, dom-if etc.

So check the networks panel for identical file names but different paths.

Example:

/bower_components/webcomponentsjs/webcomponents-loader.js
and
/components/webcomponentsjs/webcomponents-loader.js


来源:https://stackoverflow.com/questions/46731888/polymer-dommodule-already-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!