Esri / esri-leaflet

A lightweight set of tools for working with ArcGIS services in Leaflet. :rocket:
https://developers.arcgis.com/esri-leaflet/
Apache License 2.0
1.61k stars 799 forks source link

Support for Leaflet 1.9.0 #1342

Closed addy closed 2 years ago

addy commented 2 years ago

Describe the problem

Looks like esri-leaflet is currently on the 1.6.0 release of Leaflet. There have been a few changes, improvements and bug fixes since then. Does Esri have a usual timeline for incorporating new versions of Leaflet?

Describe the proposed solution

Libraries built on top of Leaflet that can be used in conjunction with Esri's plugin use more advanced versions of Leaflet. It would be great if this library supported the latest versions under the hood and allowed consumers to be able to upgrade their Leaflet dependencies.

Alternatives considered

No response

Additional Information

No response

jgravois commented 2 years ago

since leaflet is a peerDependency its up to you to install any version >= 1.0.0 that you want.

https://github.com/Esri/esri-leaflet/blob/7ee4b61140e160f3b27bcc604be5b79829f2fb9a/package.json#L77

if you're seeing a specific problem here because of a breaking change in leaflet, it'd helpful if you could describe it in detail.

addy commented 2 years ago

Sure, yeah here's the specific issue that I'm seeing:

Failed to compile.

./node_modules/esri-leaflet/src/Layers/FeatureLayer/FeatureGrid.js
Attempted import error: 'toLatLngBounds' is not exported from 'leaflet' (imported as 'latLngBounds').
gavinr commented 2 years ago

@addy thanks, can you please post the steps I would need to follow to see that error?

jgravois commented 2 years ago

i assume you'll see what @addy mentioned as soon as you:

npm install --save-dev leaflet@1.9.0
npm run build
gavinr commented 2 years ago

Thanks @jgravois for the help. That workflow actually works for me: image

addy commented 2 years ago

I'll work on getting a StackBlitz, or similar, up shortly to reproduce the error I'm seeing locally. I think it's likely an issue arising from a mix of dependencies in an external project using both Leaflet and esri-leaflet.

addy commented 2 years ago

@jgravois @gavinr Alright I've recreated the issue here: https://stackblitz.com/edit/vitejs-vite-k5qazv

Let me know if you have issues accessing that. It should build on start, but if not, you can just run npm run build

gavinr commented 2 years ago

Thanks for the reproduction case. I do see it there, and have also tested on this project: https://github.com/gavinr/esri-leaflet-react-demo/tree/leaflet-1.9 and get the same error: image

I'm wondering if this is the same issue as what's going on here: https://github.com/Leaflet/Leaflet/issues/8467 / https://github.com/Leaflet/Leaflet/issues/8451

natBizitza commented 2 years ago

I get the same errors importing heatLayer, SemiCircleMarker, and SemiCircle.

gavinr commented 2 years ago

Leaflet released v1.9.2 a few hours ago: https://github.com/Leaflet/Leaflet/releases/tag/v1.9.2

And I have tested that using 1.9.2 (instead of 1.9.0 or 1.9.1) fixes this issue for me.

@addy please test after running:

npm install leaflet@1.9.2

Thanks!

addy commented 2 years ago

Looks like it's working for me now, thanks!!