4

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.

Intervalia
  • 10,248
  • 2
  • 30
  • 60
csomakk
  • 5,369
  • 1
  • 29
  • 34
  • do you really create an element that is called `dom-module`?? obviously it is not propably possible to create element named like that – Kuba Šimonovský Oct 14 '17 at 21:05
  • Nah, it's polymer that does that. My components are named different, that's not it. – csomakk Oct 15 '17 at 22:10
  • I am getting the same error using slim.js in Chrome. When I run the same code in Mozilla, I get 'Error: A custom element with name 'slim-repeat' has already been defined. webcomponents-lite.js:136:242' – VSO Apr 24 '18 at 20:35

1 Answers1

2

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
Chris Gunawardena
  • 6,246
  • 1
  • 29
  • 45