Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting duplicate registry when importing Paper-Input in polymer 3.0 #652

Closed
1 of 8 tasks
igniparra opened this issue May 14, 2018 · 5 comments
Closed
1 of 8 tasks

Comments

@igniparra
Copy link

igniparra commented May 14, 2018

Description

Having these imports:

import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import { setPassiveTouchGestures, setRootPath } from '@polymer/polymer/lib/utils/settings.js';
import '@polymer/app-layout/app-drawer/app-drawer.js';
import '@polymer/app-layout/app-drawer-layout/app-drawer-layout.js';
import '@polymer/app-layout/app-header/app-header.js';
import '@polymer/app-layout/app-header-layout/app-header-layout.js';
import '@polymer/app-layout/app-scroll-effects/app-scroll-effects.js';
import '@polymer/app-layout/app-toolbar/app-toolbar.js';
import '@polymer/app-route/app-location.js';
import '@polymer/app-route/app-route.js';
import '@polymer/iron-pages/iron-pages.js';
import '@polymer/iron-selector/iron-selector.js';
import "@polymer/paper-button/paper-button.js";
import "@polymer/iron-flex-layout/iron-flex-layout-classes.js";
import "@polymer/paper-dialog/paper-dialog.js";
import "@polymer/paper-input/paper-input.js";
import './my-icons.js';

The paper-input import breaks the app, saying that the name of the CustomElement has already been used.

Actual outcome

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry
at Polymer (http://127.0.0.1:8081/node_modules/@polymer/polymer/lib/legacy/polymer-fn.js:43:18)
at http://127.0.0.1:8081/node_modules/@polymer/iron-meta/iron-meta.js:131:1

UPDATE: I've noticed that it has to do with this import:
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js';
on paper-input.js. It looks like another of my import has the same import, but removing it doesn't work.

I tried editing Polymer-fn.js like this:
if(customElements.get(klass)!=null) {
customElements.define(klass.is, /** @type {!HTMLElement} */(klass));
return klass;
}
else{
return customElements.get(klass);
}

But it now throws:
Uncaught TypeError: Cannot set property 'instance' of undefined
at iron-a11y-announcer.js:105

I don't know what else to try.

Steps to reproduce

Set up the sample page on polymer 3.0, and add those dependencies.

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
@anologicon
Copy link

anologicon commented May 22, 2018

Hi, I'm using iron-input, and they're giving it the same, it seems that paper-input also uses iron-punt, can it be the one that's generating it?

@herberthobregon
Copy link

herberthobregon commented May 24, 2018

This seems to be a duplication error of the polymer.js element

try

rm node_modules -rf
rm package-lock.json
npm i

Make sure that no component extracts some bower_components files

Update:
I wrote a / of more @zboralski sorry :(

@zboralski
Copy link

zboralski commented Jun 14, 2018

@herberthobregon rm -rf / ... really?
that's quite a nasty typo and I hope no one just cut and paste it as root

@notwaldorf
Copy link
Contributor

notwaldorf commented Jun 14, 2018

Yup, the problem is that you're importing polymer twice. Check out the second answer in the faq for a workaround

@flatmax
Copy link

flatmax commented Oct 18, 2018

The FAQ workaround is not the best solution IMO.
We have a method for resolving these issues, it is to do with removing nested @Polymer modules. Check it out here :
Polymer/polymer#5407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants