Uncaught TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../"

39 Views Asked by At

I was using The Lit component when I got this error: Uncaught TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../".

My code looks like this:

import { html,LitElement } from "lit";

export class MyYear extends LitElement {
    static properties = {
        year: {},
    };
    
    constructor(){
        super();
        this.year = new Date().getFullYear();
    }

    render() {
        return html `${this.year}`;
    };
};

customElements.define('year-component', MyYear);

So I changed the code to this:

import { html,LitElement } from "/lit";

But it still did not work and still got that error

I thought Aria (the opera browser AI that i'm using) will help me, but it just gave me a bit of answers

0

There are 0 best solutions below