Search code examples
javascripttypescriptleafletopenstreetmap

Runtime Error: error TS2307: Cannot find module 'leaflet'


I have problem with leaflet dictionary. I saw similar problems on stackoverflow, but it has not been resolved. I reinstalled leaflet and types, but there is still a problem. When I import L from leaflet, i have this problem

I installed leaflet like that npm install leaflet and npm install @types/leaflet

This is line of code where i have problem

import * as L from 'leaflet'


Solution

  • You should use import L from 'leaflet' :)