Hello there,
I'm running a Vue3 app with ViteJS with Leaflet 1.7.1 and I'd like to use Esri's geocoding plugin https://developers.arcgis.com/esri-leaflet/geocode-and-search/search-for-an-address/
So I ran yarn add esri-leaflet esri-leaflet-geocoder esri-leaflet-vector but as `require()` doesn't exist in vite, I tried `import esri from 'esri-leaflet'` instead but it doesn't work, since the lib doesn't provide a default export.
Example:
<script setup>
import L from 'leaflet';
import esri from 'esri-leaflet';
// ...
</script>
Any idea what / how to import the library in a Vite context?
Thanks!
Ben
Solved! Go to Solution.
Hi, thanks for the question.
I think you want to import the named module, like this:
import { FeatureLayer } from "esri-leaflet";
import { vectorBasemapLayer } from "esri-leaflet-vector";
Hi, thanks for the question.
I think you want to import the named module, like this:
import { FeatureLayer } from "esri-leaflet";
import { vectorBasemapLayer } from "esri-leaflet-vector";