Open TannerJuby1 opened 2 years ago
Hi, I think that import style is correct when using ES6 import style.
Import style works, but the way the documentation shows to use it does not.
Hi, thanks for the feedback. Which documentation are you referring to?
Under the API Reference section of this repo's README, it shows to use L.esri.Geocoding.
indicating it extends the L
import of Leaflet, but it does not. You have to import it and use it separately
Thanks...
<script src="https://unpkg.com/esri-leaflet-geocoder"></script>
), then you access via L.esri.Geocoding....
import * as .... from 'esri-leaflet-geocoder'
then you'd refer to it directly using the imported name. Either are valid, but the documentation focuses on number 1 since that is the pattern that most Leaflet users are following. I think your confusion is that number 2 is not really mentioned in the documentation, and that's a fair critique, as more people start to use the import...
style. I'll rename this issue so that we can tackle that documentation update. PRs welcome!
Note that before we document using this library with ESM, we'll need to get the other Esri Leaflet libraries working with ESM here: https://github.com/Esri/esri-leaflet/issues/1386
So if anyone has time to look into that one ^ it would be much appreciated.
Any update on this one as I am unable to use the geocoder with esri-leaflet-vector?
@shakyad please see my response in the other thread: https://github.com/Esri/esri-leaflet-geocoder/issues/318#issuecomment-2312607259
I installed this project via npm as well as it's types for my Gatsby (react) project, but I am unable to use it thru the leaflet package as the documentation suggests.
I ran
npm i esri-leaflet-geocoder --save
andnpm i @types/esri-leaflet-geocoder --save
which installed properly, but when I go to use the geocode like the documentation suggests:I get a runtime error that
Geocoder
is undefined.I can get around this by importing the package directly:
However, when I do it this way. I run into issues with the api key that I've opened another issue about