PolymerElements / iron-elements

Core elements
47 stars 23 forks source link

polymer 3 project imports failure #54

Open sashafirsov opened 4 years ago

sashafirsov commented 4 years ago

Description

iron-elements and its dependencies are not compiled by polymer-cli due to import('@polymer/iron-behaviors') unable to resolve the module type "node".

Most of modules from iron-elements collection actually are written as es6 modules and only missing part is package.json module type properly set.

Some modules like iron-elements are not yet ported to es6 modules yet. Since iron-elements is just a dependencies aggregation, it should be a low hanging fruit to port.

Expected outcome

polymer 3 project build passed without compile errors.

Actual outcome

Could not resolve module specifier "@polymer/iron-behaviors" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements.js" . Could not resolve module specifier "@polymer/iron-demo-helpers" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements. js". Could not resolve module specifier "@polymer/iron-doc-viewer" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements.js ". Could not resolve module specifier "@polymer/iron-flex-layout" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements.j s". Could not resolve module specifier "@polymer/iron-menu-behavior" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements .js". Could not resolve module specifier "@polymer/iron-page-url" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements.js". Could not resolve module specifier "@polymer/iron-selector" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements.js". Could not resolve module specifier "@polymer/iron-signals" in file "C:\aWork\polymer3-vaadin14-portlet\modules\polymer-vaadin-portlet\src\main\resources\META-INF\resources\webcomponents\load-iron-elements.js".

Live Demo

https://github.com/sashafirsov/polymer3-vaadin14-portlet/blob/iron-elements-error/modules/polymer-vaadin-portlet/src/main/resources/META-INF/resources/webcomponents/load-iron-elements.js

has imports of modules incompatible with polymer 3 commented out. If uncomment, each line would produce the compile error.

Steps to reproduce

  1. create Polymer 3 Component with cli
  2. add one of iron-elements dependencies as import statement to generated element
  3. run polymer build
  4. observe error with unresolved module