I created a new web component library project based on :
- [email protected]
- [email protected]
using Vite’s library mode (see https://dev.to/receter/how-to-create-a-react-component-library-using-vites-library-mode-4lma)
Inside this library, i defined a component called “my-title” :
import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import styles from './styles.module.css';
@customElement('my-title')
export class myTitle extends LitElement {
...
}
When i build my library, everything is ok.
And then i want to use it inside a PolymerJs 2 project.
But when i import the library i receive this error :
Failed to resolve module specifier “lit”. Relative references must
start with either “/”, “./”, or “../”
Bare import work well inside my library when i use vite bundler to run and deploy this project.
But how can i use this library inside another project without bundler and without error ?