Search code examples
polymervaadinweb-componentcodesandbox

Problems when loading Vaadin/Polymer custom elements (Error message: (0 , $csb__dommodule.DomModule).import is not a function)


Could someone please help me and tell me what I am doing wrong here when I try to load a vaadin custom element button, because I get an error message (0 , $csb__dommodule.DomModule).import is not a function? TYVM :)

import "@vaadin/vaadin-button";

document.getElementById("app").innerHTML = `
  <h4>Vaadin Button</h4>
  <section>
    <vaadin-button>This is a button</vaadin-button>
  </section>
`;

https://codesandbox.io/s/recursing-swartz-tbe4y?file=/src/index.js


Solution

  • This is a codesanbox specific issue. If you run your sandbox locally then it works fine. I just tested thatenter image description here

    Steps:

    1. export your sandbox
    2. run npm i
    3. run npm start

    I just created this issue in codesandbox client repo.

    Working webcomponents.dev demo: https://webcomponents.dev/edit/RvnCgQUcXyckBJdjBCgl

    Update: Linked Codesandbox issue has been fixed :)