<?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: ES Modules not working with React Declarative Routing in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1019089#M71466</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;Thank you so much, I really appreciate your support, It works now!&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":raising_hands:"&gt;🙌&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2021 14:17:22 GMT</pubDate>
    <dc:creator>supegui</dc:creator>
    <dc:date>2021-01-22T14:17:22Z</dc:date>
    <item>
      <title>ES Modules not working with React Declarative Routing</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1018681#M71455</link>
      <description>&lt;P&gt;Hi, I hope you're doing great.&lt;/P&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;I feel this is a bug using the ES Module for React, please take a look and confirm.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;I'm trying to use the new ES Module on a React app (&lt;EM&gt;@Anonymous User/core&lt;/EM&gt;), I followed the documentation doing this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;1. &lt;EM&gt;npm install&amp;nbsp;@Anonymous User/core&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;2. inside the package.json, I added the script for coping the assets to the public folder generated by webpack (I'm using create-react-app) --&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;"copy"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"ncp ./node_modules/@arcgis/core/assets ./public/assets"&lt;/SPAN&gt;&lt;/EM&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This is the issue, inside the React app I'm using declarative routing (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;react-router-dom&lt;/SPAN&gt;&lt;SPAN&gt;) and when placing the map component inside of a root path &lt;/SPAN&gt;&lt;A href="http://myapp.com/map" target="_blank" rel="noopener"&gt;&lt;FONT face="inherit"&gt;http://myapp.com&lt;/FONT&gt;&lt;STRONG&gt;/map&lt;/STRONG&gt;&lt;/A&gt;&lt;SPAN&gt;, it works pretty well, and no error to load the map.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;but when placing the map inside of a subpath&amp;nbsp;&lt;A href="http://myapp.com/map" target="_blank" rel="noopener"&gt;http://myapp.com&lt;STRONG&gt;/main/map&lt;/STRONG&gt;&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;the map is not able to load and it breaks showing the error:&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;LI-SPOILER&gt;Refused to execute script from '&lt;STRONG&gt;http://localhost:3003/main/assets/esri/core/workers/RemoteClient.js&lt;/STRONG&gt;' because its MIME type ('text/html') is not executable.&lt;/LI-SPOILER&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;SPAN&gt;if you check the error and the URL the error is throwing, the Arcgis Map (&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;EM&gt;@Anonymous User/core&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;) is trying to get the copied assets from the folder &lt;EM&gt;&lt;STRONG&gt;/public/main/assets &lt;/STRONG&gt;&lt;/EM&gt;and not for the &lt;STRONG&gt;&lt;EM&gt;/public/asset&lt;/EM&gt;s&lt;/STRONG&gt; where it should always find them. And that's because the map was located inside the route &lt;STRONG&gt;&lt;EM&gt;/main/map.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;I really appreciate your support,&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Jan 2021 15:08:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1018681#M71455</guid>
      <dc:creator>supegui</dc:creator>
      <dc:date>2021-01-21T15:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: ES Modules not working with React Declarative Routing</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1018712#M71457</link>
      <description>&lt;P&gt;You need to configure the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#assetsPath" target="_self"&gt;assetsPath&lt;/A&gt; of the API, so it can properly locate them in this situation.&lt;/P&gt;&lt;P&gt;Something like this.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;config.assetsPath = "/assets"; // look at the root of the domain.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;A href="https://github.com/Esri/jsapi-resources/blob/master/esm-samples/jsapi-angular-cli/src/app/app.component.ts#L78" target="_self"&gt;angular demo&lt;/A&gt; does this for its routing feature.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 16:22:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1018712#M71457</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-01-21T16:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: ES Modules not working with React Declarative Routing</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1019089#M71466</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;Thank you so much, I really appreciate your support, It works now!&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":raising_hands:"&gt;🙌&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 14:17:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/es-modules-not-working-with-react-declarative/m-p/1019089#M71466</guid>
      <dc:creator>supegui</dc:creator>
      <dc:date>2021-01-22T14:17:22Z</dc:date>
    </item>
  </channel>
</rss>

