1

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?

cstff
  • 123
  • 1
  • 9
  • What happens when you run `./node_modules/.bin/tsc --noemit --project tsconfig.json` from the command line? – Aluan Haddad Sep 27 '19 at 19:50
  • Hi @AluanHaddad, When I do this I get the same error – cstff Sep 30 '19 at 19:31
  • Then the error has nothing to do with `@babel/preset-typescript` or any other loader. It is a static typechecking error from the TypeScript language. You need to track it down – Aluan Haddad Oct 01 '19 at 18:16

1 Answers1

11

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

Kuroiyatsu
  • 586
  • 5
  • 10