<?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 Re: AMD to ESM in Simplified Display a Map Example in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115075#M75202</link>
    <description>&lt;P&gt;Is there a particular error with this sample? Are you using your API key from developers.arcgis.com?&lt;/P&gt;&lt;P&gt;Here's a video that walks through the steps.&lt;/P&gt;&lt;P&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdMSMhlvhNkU%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdMSMhlvhNkU&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdMSMhlvhNkU%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="200" height="112" scrolling="no" title="Using API Keys with the ArcGIS API for JavaScript [Outdated]" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Nov 2021 22:10:51 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2021-11-08T22:10:51Z</dc:date>
    <item>
      <title>AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115052#M75200</link>
      <description>&lt;P&gt;Hello all! This is my first post beyond my introduction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought it would be good to see if I could convert my JavaScript code for the &lt;A href="https://developers.arcgis.com/javascript/latest/display-a-map/" target="_self"&gt;Display a Map tutorial&lt;/A&gt; from AMD to ESM. When it didn't work, I made an even simpler version -- which still doesn't work. &amp;lt;g&amp;gt;&lt;/P&gt;&lt;P&gt;This is the AMD version that works as-expected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
    "esri/config",
    "esri/Map", 
    "esri/views/MapView"
], function(esriConfig, Map, MapView) {

        esriConfig.apiKey = "not-my-actual-api-key";

        // create basemap 
        const map = new Map({
            basemap: "arcgis-navigation"
        });

        // set a map view
        const view = new MapView({
        map: map,
        center: [-82.998794, 39.961176], // Columbus, Ohio 39.961176 / -82.998794
        zoom: 9,
        container: "viewDiv" 
        });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the ESM version that does not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import esriConfig from "@arcgis/core/config";
import Map from "@arcgis/core/Map";
import MapView from "@arcgis/core/views/MapView";


esriConfig.apiKey = "not-my-actual-api-key";

// create basemap 
const map = new Map({
    basemap: "arcgis-navigation"  
});

// set a map view
const view = new MapView({
map: map,
center: [-82.998794, 39.961176], // Columbus, Ohio 39.961176 / -82.998794
zoom: 9, 
container: "viewDiv"
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything below the API code is the same, so I am supposing the trouble happens there or above. With that in mind, I was seeking an ESM example of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html" target="_self"&gt;config&lt;/A&gt;&amp;nbsp;using the API key, but I could not find one. Also, I am supposing I shouldn't post my actual API key, so I removed that from both blocks of code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What changes would fix the ESM code?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 01:43:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115052#M75200</guid>
      <dc:creator>IfThenTim</dc:creator>
      <dc:date>2021-11-10T01:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115075#M75202</link>
      <description>&lt;P&gt;Is there a particular error with this sample? Are you using your API key from developers.arcgis.com?&lt;/P&gt;&lt;P&gt;Here's a video that walks through the steps.&lt;/P&gt;&lt;P&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdMSMhlvhNkU%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdMSMhlvhNkU&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdMSMhlvhNkU%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="200" height="112" scrolling="no" title="Using API Keys with the ArcGIS API for JavaScript [Outdated]" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 22:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115075#M75202</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-11-08T22:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115493#M75220</link>
      <description>&lt;P&gt;Thank you for your reply and the link to the video. I learned a lot watching that video, but I was not able to resolve my problem or quickly/easily replicate the results of the video. I did notice some naming differences in loading config and the API key compared to what I was doing.&lt;BR /&gt;&lt;BR /&gt;Given that using AMD eliminates all of the problems in my test example, it's practical enough for me to embrace that approach for the near term.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 01:38:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115493#M75220</guid>
      <dc:creator>IfThenTim</dc:creator>
      <dc:date>2021-11-10T01:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115513#M75222</link>
      <description>&lt;P&gt;You didn't provide enough details to understand your problem but I believe that if you'll follow closely the following tutorial, you won't have any issues -&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/display-a-map/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/display-a-map/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 03:20:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115513#M75222</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-11-10T03:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115999#M75251</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/535242"&gt;@IfThenTim&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I was wondering if you installed the ES modules with npm?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;npm install @arcgis/core&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Otherwise you would need to change your import statements to use the ES modules CDN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import esriConfig from "https://js.arcgis.com/4.21/@arcgis/core/config.js";
import MapView from "https://js.arcgis.com/4.21/@arcgis/core/views/MapView.js";
import Map from "https://js.arcgis.com/4.21/@arcgis/core/Map.js";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think this is explained in the tutorial, as it assumes you are using AMD, but it is described on the install and setup webpage:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/install-and-set-up/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/install-and-set-up/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There are also some samples using ES modules available on GitHub:&amp;nbsp;&lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples" target="_blank" rel="noopener"&gt;https://github.com/Esri/jsapi-resources/tree/master/esm-samples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you intend to use the ES modules from CDN also make sure and change your script tag to be of type module&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;script type="module"&amp;gt;
....
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Sage&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 13:00:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1115999#M75251</guid>
      <dc:creator>Sage</dc:creator>
      <dc:date>2021-11-11T13:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1117056#M75298</link>
      <description>&lt;BLOCKQUOTE&gt;I was wondering if you installed the ES modules with npm?&lt;/BLOCKQUOTE&gt;&lt;P&gt;That's a good question, but yes, I did install the ES Modules with npm.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 22:40:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1117056#M75298</guid>
      <dc:creator>IfThenTim</dc:creator>
      <dc:date>2021-11-15T22:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: AMD to ESM in Simplified Display a Map Example</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1117057#M75299</link>
      <description>&lt;P&gt;To maybe bring some sort of closure to this: After doing the Display a Map tutorial, I tried to adapt it for Angular using ES modules. When that did not work, I thought I might simplify it for seeking support to bring it back to vanilla JS. But in reading/watching more video on my own, I think I have discovered that I lost the "bundler" functionality needed to use ES modules. And/or there may be other problems too. &amp;lt;g&amp;gt;&lt;BR /&gt;&lt;BR /&gt;If I decide to ask for support on running something like the Display a Map exercise in Angular with ES modules, I will make a separate post for that. Thanks to all who attempted to assist me. I have a lot to learn.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 22:52:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/amd-to-esm-in-simplified-display-a-map-example/m-p/1117057#M75299</guid>
      <dc:creator>IfThenTim</dc:creator>
      <dc:date>2021-11-15T22:52:06Z</dc:date>
    </item>
  </channel>
</rss>

