iron-elements
iron-elements copied to clipboard
polymer 3 project imports failure
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
- create Polymer 3 Component with cli
- add one of iron-elements dependencies as import statement to generated element
- run
polymer build
- observe error with unresolved module