I updated my project from Polymer-2.x to Polymer-3.x and now, when I just open my index,html in my browser I get 'Uncaught TypeError: Failed to resolve module specifier "@polymer/polymer/polymer-element.js". Relative references must start with either "/", "./", or "../".'
I enabled the relative path support in chrome but it still does not work.
With polymer serve
it works fine, but I need it to work via IIS because it refers its url in its code and I have routing to do with it. So localhost is not an option for me.
Is there a way, so I can get it work without polymer serve
?
As far as I know, the polymer serve
-command replaces npm-paths (e.g. @polymer/polymer/polymer-element.js
) with relative paths (e.g. ../node_modules/@polymer/polymer/polymer-element.js
) to serve these files. So without that command, your browser does not know where the files are located.
To build a polymer project for production the polymer-cli
has a command called polymer build
to replace these paths automatically and that should solve your problem. Additionally that helpful command may bundle the project and minify your files. Just have a look at the documentation
Alternatively you could just replace them manually with relative paths.