bluehalo / ngx-leaflet

Core Leaflet package for Angular.io
MIT License
767 stars 126 forks source link

export 'markerClusterGroup' (imported as 'L') was not found in 'leaflet' #340

Open krabouilleur opened 1 year ago

krabouilleur commented 1 year ago

On "ng build" the following error : "export 'markerClusterGroup' (imported as 'L') was not found in 'leaflet'"

the package.json :

"dependencies": {
    "@angular/animations": "^14.2.4",
    "@angular/cdk": "^14.2.3",
    "@angular/common": "^14.2.4",
    "@angular/compiler": "^14.2.4",
    "@angular/core": "^14.2.4",
    "@angular/forms": "^14.2.4",
    "@angular/material": "^14.2.3",
    "@angular/platform-browser": "^14.2.4",
    "@angular/platform-browser-dynamic": "^14.2.4",
    "@angular/router": "^14.2.4",
    "@asymmetrik/ngx-leaflet": "^14.0.1",
    "@asymmetrik/ngx-leaflet-markercluster": "^14.0.1",
    "@fortawesome/angular-fontawesome": "~0.11.1",
    "@fortawesome/fontawesome-svg-core": "^6.2.0",
    "@fortawesome/free-solid-svg-icons": "^6.2.0",
    "@juggle/resize-observer": "^3.4.0",
    "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
    "@turf/turf": "^6.5.0",
    "@types/echarts": "^4.9.16",
    "@types/file-saver": "^2.0.5",
    "@types/leaflet": "^1.8.0",
    "@types/leaflet.markercluster": "^1.5.1",
    "angular-oauth2-oidc": "^13.0.1",
    "crypto-js": "^4.1.1",
    "echarts": "^5.4.0",
    "file-saver": "^2.0.5",
    "jwt-decode": "^3.1.2",
    "leaflet": "^1.9.1",
    "leaflet.markercluster": "^1.5.3",
    "material-design-icons-iconfont": "^6.7.0",
    "moment": "^2.29.4",
    "ng-swagger-gen": "^2.3.1",
    "ngx-echarts": "^14.0.0",
    "ngx-mat-select-search": "^4.2.1",
    "npm-check-updates": "^16.3.3",
    "rxjs": "~7.5.7",
    "tslib": "^2.4.0",
    "zone.js": "~0.11.8"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.4",
    "@angular/cli": "^14.2.4",
    "@angular/compiler-cli": "^14.2.4",
    "@types/crypto-js": "^4.1.1",
    "@types/jasmine": "~4.3.0",
    "@types/node": "^18.7.23",
    "crypto-browserify": "^3.12.0",
    "jasmine-core": "^4.4.0",
    "karma": "^6.4.1",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "^5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "ng-openapi-gen": "^0.23.0",
    "stream-browserify": "^3.0.0",
    "typescript": "~4.8.4"
  }
nielswitte commented 1 year ago

This is probably since this library isn't compatible with the latest leaflet version. From leaflet 1.9.0 change log https://leafletjs.com/2022/09/21/leaflet-1.9.0.html:

Removing the Leaflet global. As a developer using Leaflet, the capital letter L is probably intimately familiar to you. This is the Leaflet global where all of Leaflet’s functionality lives. To allow compiler tooling to better eliminate dead-code through a process called tree-shaking, we are removing this global variable. To preserve backwards compatibility with older plugins, we will provide a shim that can be imported manually that will restore this functionality.

The shim mentioned in the change log could provide a solution, but I don't know if it is available yet.