问题
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