how to Implement lit-element-bootstrap package in lit-lement
Asked Answered
C

2

0

I would like to implement lit-element-bootstrap package in lit-element.

I am getting following error in console, Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec

//header.js
import { LitElement, html, css } from 'https://unpkg.com/@polymer/lit-element/lit-element.js?module';
import  'https://unpkg.com/[email protected]/lit-element-bootstrap';

export class Header extends LitElement{
    constructor() {
        super();
    }
    render(){
        return html`
        <bs-alert primary>
         <div>A simple primary alert—check it out!</div>
        </bs-alert>
        `;
    }
}
customElements.define('header-element', Header);


//index.html

<!doctype html>
<html>
  <head>
  <script src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-bundle.js"></script>
  <script src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-loader.js"></script>
     <script type = "module" src = "../components/header.js"></script>
  </head>  
<body>   
<header-element></header-element>
 </body>
</html>


Chuddar answered 31/5, 2019 at 2:46 Comment(0)
E
0

The URL you are trying to import from is getting redirected (302).

Current URL: https://unpkg.com/@polymer/lit-element/lit-element.js?module

Try changing it to: https://unpkg.com/@polymer/[email protected]/lit-element.js?module

Not sure if you should be loading it from this URL always, you can download the file and import it from your directory, rather than downloading it from this new URL. As this new URL can also change in future.

Ensheathe answered 31/5, 2019 at 5:31 Comment(0)
E
0

lit-element has been updated, the correct link would be https://unpkg.com/lit-element or if you want to specify the extension https://unpkg.com/lit-element/lit-element.js

Excelsior answered 12/2, 2020 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.