Search code examples
typescriptlit-element

lit-element in typescript. Cannot find module


I have cloned this repository that uses @babel/preset-typescript instead of ts-loader.

https://github.com/a-tarasyuk/webpack-typescript-babel

Then I added lit-element as a dependency

yarn add lit-element

However, when I import the following

import {LitElement, html, css, customElement, property} from 'lit-element';

I get the following error:

src / index.ts: 5: 62 - error TS2307: Cannot find module 'lit-element'.

I am a beginner, am I forgetting something?


Solution

  • When I had this issue, adding: "moduleResolution": "node", to the compilerOptions in the ts.config file worked for me.