<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [Newcomer] Usage with Vite? in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/newcomer-usage-with-vite/m-p/1182651#M57</link>
    <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;I'm running a Vue3 app with ViteJS with Leaflet 1.7.1 and I'd like to use Esri's geocoding plugin&amp;nbsp;&lt;A href="https://developers.arcgis.com/esri-leaflet/geocode-and-search/search-for-an-address/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/esri-leaflet/geocode-and-search/search-for-an-address/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So I ran yarn add esri-leaflet&amp;nbsp;esri-leaflet-geocoder&amp;nbsp;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.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;script &lt;/SPAN&gt;&lt;SPAN&gt;setup&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;L &lt;SPAN&gt;from &lt;/SPAN&gt;&lt;SPAN&gt;'leaflet'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;esri &lt;SPAN&gt;from &lt;/SPAN&gt;&lt;SPAN&gt;'esri-leaflet'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;// ...&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea what / how to import the library in a Vite context?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2023 20:05:23 GMT</pubDate>
    <dc:creator>Benoit</dc:creator>
    <dc:date>2023-08-25T20:05:23Z</dc:date>
    <item>
      <title>[Newcomer] Usage with Vite?</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/newcomer-usage-with-vite/m-p/1182651#M57</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;I'm running a Vue3 app with ViteJS with Leaflet 1.7.1 and I'd like to use Esri's geocoding plugin&amp;nbsp;&lt;A href="https://developers.arcgis.com/esri-leaflet/geocode-and-search/search-for-an-address/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/esri-leaflet/geocode-and-search/search-for-an-address/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So I ran yarn add esri-leaflet&amp;nbsp;esri-leaflet-geocoder&amp;nbsp;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.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;script &lt;/SPAN&gt;&lt;SPAN&gt;setup&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;L &lt;SPAN&gt;from &lt;/SPAN&gt;&lt;SPAN&gt;'leaflet'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;esri &lt;SPAN&gt;from &lt;/SPAN&gt;&lt;SPAN&gt;'esri-leaflet'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;// ...&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea what / how to import the library in a Vite context?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 20:05:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/newcomer-usage-with-vite/m-p/1182651#M57</guid>
      <dc:creator>Benoit</dc:creator>
      <dc:date>2023-08-25T20:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: [Newcomer] Usage with Vite?</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/newcomer-usage-with-vite/m-p/1184639#M58</link>
      <description>&lt;P&gt;Hi, thanks for the question.&lt;/P&gt;&lt;P&gt;I think you want to import the named module, like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { FeatureLayer } from "esri-leaflet";
import { vectorBasemapLayer } from "esri-leaflet-vector";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://github.com/gavinr/esri-leaflet-react-demo/blob/90f910ec5a45f56089853eff437b353c73457fff/src/Map.js#L4-L5" target="_blank"&gt;https://github.com/gavinr/esri-leaflet-react-demo/blob/90f910ec5a45f56089853eff437b353c73457fff/src/Map.js#L4-L5&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 13:17:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/newcomer-usage-with-vite/m-p/1184639#M58</guid>
      <dc:creator>GavinRehkemper</dc:creator>
      <dc:date>2022-06-21T13:17:51Z</dc:date>
    </item>
  </channel>
</rss>

