Vue2Leaflet: build error Cannot find namespace 'L'

Description

hello everyone i use vue-cli@3.x & typescript template but i got a build error

Steps to Reproduce

just execyarn build

Expected Results

No error is throw

Actual Results

image

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Any update on this? I’m using the very same setup of @Xixi20160512. I also installed @types/leaflet, but the error persists.

UPDATE: I solved this by adding a /types/vue2-leaflet.d.ts file to my project…

declare module 'vue2-leaflet' {
    import * as  L from 'leaflet'
    export { L }
}

i’m useing "vue2-leaflet": "^2.1.1", and still getting the types error (on vue-cli-service serve).

I had to install @types/leaflet and include @JimmyBastos 's declare ... file (https://github.com/KoRiGaN/Vue2Leaflet/issues/291#issuecomment-460058926) to get it running again.

I can confirm the fix: you need to manually install types: npm i -D @types/leaflet

@JimmyBastos yep thats the quickest way to fix it. the code in master should not have the issue.