3

Hi I want to execute polymer component(polymer3.x) in visual studio,I am able to run polymer cli and polymer serve and I can see outputs.but when I try to execute my code in visual studio project I get `error

Failed to resolve module specifier "@polymer/polymer/lib/utils/import-href.js". Relative references must start with either "/", "./", or "../".

I find this link https://github.com/Polymer/tools/issues/363 but I am confused what should I change ? By the way I change my relative path @polymer/polymer/ to ../polymer/polymer/ but not work

`

Bilgehan
  • 1,135
  • 1
  • 14
  • 41

1 Answers1

0

I tried with visual studio 2017 and it work but relative paths are important

in polymer element polymer-element.js must be imported

import { PolymerElement, html } from '../node_modules/@polymer/polymer/polymer-element.js';

and in your html page webcomponents-loader.js must be added,and you add your polymer eleement with script which type is module

>  <script
> src="node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
> 
>  <script src="component/my-polymerelement.js" type="module">
Bilgehan
  • 1,135
  • 1
  • 14
  • 41