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

[polyserve] Duplicate CE definition errors in Firefox and Edge when combining paths and bare specifiers in tests #203

Closed
web-padawan opened this issue Apr 23, 2018 · 2 comments
Assignees

Comments

@web-padawan
Copy link
Contributor

web-padawan commented Apr 23, 2018

Description

Tests for some of the Vaadin components are failing, because of external dependency usage. They pass in Chrome and Safari, but produce the errors like this in Firefox and Edge:

"Error: A custom element with name 'vaadin-text-field' has already been defined."

Most likely caused by not deduplicating requests originated from modulizer output:

  • <script type="module" src="../../../@vaadin/vaadin-text-field/vaadin-text-field.js"></script>
  • import '@vaadin/vaadin-text-field/vaadin-text-field.js';

Versions & Environment

  • Polymer CLI: 1.7.0-pre.13
  • node: 8.11.1
  • Operating System: Mac OS

Steps to Reproduce

  1. Clone the repo:
git clone --depth 1 -b p3-preview-bare git://github.com/vaadin/vaadin-list-box.git && cd vaadin-list-box
  1. Install the modulizer:
git clone git://github.com/Polymer/polymer-modulizer.git && cd polymer-modulizer && npm link
  1. Install the tools:
npm i -g bower yarn magi-cli polymer-cli@next
  1. Install bower dependencies:
bower install
  1. Reset the last commit (containing the workaround):
git reset --hard HEAD^1
  1. Run the conversion:
magi p3-convert --out . --import-style=name
  1. Install dependencies:
yarn installl --flat
  1. Serve the component:
polymer serve --npm --module-resolution=node
  1. Open the Firefox and go to http://127.0.0.1:8081/components/@vaadin/vaadin-list-box/test/

Workaround

We managed to solve this by putting the external HTML imports inside of the different file, then importing that one in test suite, in order to get same paths for HTML and JS. See it here:

Expected Results (with the workaround):

Tests passing, see the builds above and the screenshot:

screen shot 2018-04-23 at 14 10 46

Actual Results (1.7.0-pre.4)

Tests failing, see the builds:

screen shot 2018-04-23 at 14 12 11

PS: also looks related to Polymer/polymer-modulizer#408

@aomarks
Copy link
Member

aomarks commented May 2, 2018

@web-padawan Just released polymer-cli@polymer-cli@1.7.0-pre.16 with a new AMD loader which may help with this problem. Let me know how it goes!

@web-padawan
Copy link
Contributor Author

I have tried the new version and both broken components now work fine. Thanks!

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

2 participants