<?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 ESM error when trying to import Map from &amp;quot;@arcgis/core/Map&amp;quot; from ESRI JSAPI v4.20 on CRA in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esm-error-when-trying-to-import-map-from-quot/m-p/1096314#M74596</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write tests using the &lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app" target="_self"&gt;create react app example&lt;/A&gt;&amp;nbsp;and am getting the following error:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KenjooYeap_0-1631102818643.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22590i1F2706873D5920D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KenjooYeap_0-1631102818643.png" alt="KenjooYeap_0-1631102818643.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;To reproduce the error:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;-&amp;nbsp; `git clone &lt;A href="https://github.com/Esri/jsapi-resources.git`" target="_blank" rel="noopener"&gt;https://github.com/Esri/jsapi-resources.git`&lt;/A&gt;&lt;/P&gt;&lt;P&gt;- npm i&lt;/P&gt;&lt;P&gt;- go to create-react-app example&amp;nbsp;&lt;/P&gt;&lt;P&gt;- add `&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Map&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/Map"&lt;/SPAN&gt;&lt;SPAN&gt;;`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- replace "&lt;/SPAN&gt;&lt;SPAN&gt;MapView" with "Map"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- `npm run test`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be much appreciated! &lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Sep 2021 12:39:21 GMT</pubDate>
    <dc:creator>KenjooYeap</dc:creator>
    <dc:date>2021-09-08T12:39:21Z</dc:date>
    <item>
      <title>ESM error when trying to import Map from "@arcgis/core/Map" from ESRI JSAPI v4.20 on CRA</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esm-error-when-trying-to-import-map-from-quot/m-p/1096314#M74596</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write tests using the &lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app" target="_self"&gt;create react app example&lt;/A&gt;&amp;nbsp;and am getting the following error:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KenjooYeap_0-1631102818643.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22590i1F2706873D5920D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KenjooYeap_0-1631102818643.png" alt="KenjooYeap_0-1631102818643.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;To reproduce the error:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;-&amp;nbsp; `git clone &lt;A href="https://github.com/Esri/jsapi-resources.git`" target="_blank" rel="noopener"&gt;https://github.com/Esri/jsapi-resources.git`&lt;/A&gt;&lt;/P&gt;&lt;P&gt;- npm i&lt;/P&gt;&lt;P&gt;- go to create-react-app example&amp;nbsp;&lt;/P&gt;&lt;P&gt;- add `&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Map&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/Map"&lt;/SPAN&gt;&lt;SPAN&gt;;`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- replace "&lt;/SPAN&gt;&lt;SPAN&gt;MapView" with "Map"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- `npm run test`&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be much appreciated! &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 12:39:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esm-error-when-trying-to-import-map-from-quot/m-p/1096314#M74596</guid>
      <dc:creator>KenjooYeap</dc:creator>
      <dc:date>2021-09-08T12:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: ESM error when trying to import Map from "@arcgis/core/Map" from ESRI JSAPI v4.20 on CRA</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esm-error-when-trying-to-import-map-from-quot/m-p/1096478#M74610</link>
      <description>&lt;P&gt;If you add new ArcGIS imports into modules you're testing or change them, you need to add new mocks as well. The mocks are located here.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app/src/__mocks__/%40arcgis/core" target="_blank" rel="noopener"&gt;https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app/src/__mocks__/%40arcgis/core&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You might be able to use transformIgnorePatterns, but I couldn't get it to work with CRA.&lt;/P&gt;&lt;P&gt;&lt;A href="https://jestjs.io/docs/configuration#transformignorepatterns-arraystring" target="_blank" rel="noopener"&gt;https://jestjs.io/docs/configuration#transformignorepatterns-arraystring&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Might need some more jest config options. It works in this angular demo, but CRA complains about some stuff.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/andygup/angular-jsapi-jest" target="_blank" rel="noopener"&gt;https://github.com/andygup/angular-jsapi-jest&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 17:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esm-error-when-trying-to-import-map-from-quot/m-p/1096478#M74610</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-09-08T17:11:06Z</dc:date>
    </item>
  </channel>
</rss>

