<?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 Resolving imports for widget .tsx files in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1088723#M74275</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Is it possible to edit and compile the .tsx files provided by ESRI as a way of making custom widgets eg&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-js-api/blob/4master/widgets/Sketch.tsx" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-js-api/blob/4master/widgets/Sketch.tsx&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I followed the tutorials, but instead of a new .tsx file I started with the one linked above.&amp;nbsp; I was able to add a custom &amp;lt;div&amp;gt; section and some custom functionality, and although the code compiled with errors, it ran fine in the browser.&lt;/P&gt;&lt;P&gt;The compile errors had to do with not being able to resolve imports, for example it can't find the following import :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { eventKey } from "esri/core/events";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Some of the imports would resolve if they changed slightly like:&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Graphic&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"esri/widgets/../Graphic"&lt;/SPAN&gt;&lt;SPAN&gt;; -&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Graphic&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"esri/Graphic"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Others I can't find at all like VNode or eventKey even after doing npm install&amp;nbsp;@arcgis/core, which I don't even know if that is correct or needed.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Is it possible to start with the .tsx file of the widget from ESRI, and if so how to resolve the imports that don't seem to be present or require altering the import paths?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 13 Aug 2021 00:54:32 GMT</pubDate>
    <dc:creator>FrederickPowers</dc:creator>
    <dc:date>2021-08-13T00:54:32Z</dc:date>
    <item>
      <title>Resolving imports for widget .tsx files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1088723#M74275</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Is it possible to edit and compile the .tsx files provided by ESRI as a way of making custom widgets eg&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-js-api/blob/4master/widgets/Sketch.tsx" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-js-api/blob/4master/widgets/Sketch.tsx&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I followed the tutorials, but instead of a new .tsx file I started with the one linked above.&amp;nbsp; I was able to add a custom &amp;lt;div&amp;gt; section and some custom functionality, and although the code compiled with errors, it ran fine in the browser.&lt;/P&gt;&lt;P&gt;The compile errors had to do with not being able to resolve imports, for example it can't find the following import :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { eventKey } from "esri/core/events";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Some of the imports would resolve if they changed slightly like:&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Graphic&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"esri/widgets/../Graphic"&lt;/SPAN&gt;&lt;SPAN&gt;; -&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Graphic&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"esri/Graphic"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Others I can't find at all like VNode or eventKey even after doing npm install&amp;nbsp;@arcgis/core, which I don't even know if that is correct or needed.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Is it possible to start with the .tsx file of the widget from ESRI, and if so how to resolve the imports that don't seem to be present or require altering the import paths?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Aug 2021 00:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1088723#M74275</guid>
      <dc:creator>FrederickPowers</dc:creator>
      <dc:date>2021-08-13T00:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving imports for widget .tsx files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1088896#M74279</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/480908"&gt;@FrederickPowers&lt;/a&gt;&amp;nbsp;going forward all the widget view-based .tsx files will be marked deprecated, we are in the process of doing that for the upcoming 4.21 release (tentatively late September). The missing imports are just one of several reasons why we don't recommend that pattern anymore.&lt;/P&gt;&lt;P&gt;Note, you will still be able to build custom widgets, here's the documentation for that:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/custom-widget/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/custom-widget/.&lt;/A&gt;&amp;nbsp;The current doc uses the AMD pattern, we are also in the process of updating them for ES modules, and there will be a new sample using that pattern.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 15:07:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1088896#M74279</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2021-08-13T15:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving imports for widget .tsx files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1089028#M74285</link>
      <description>&lt;P&gt;Thank you for the explanation.&lt;/P&gt;&lt;P&gt;I just followed the link for custom widget creation, but instead of subclassing Widget, I subclassed BasemapGallery and overrode the render() method by copying the render() method from the BasemapGallery .tsx to add a header div and a custom button, just as proof of concept. After adding the necessary properties and private methods, the new .tsx didn't have any import issues and compiled without error.&lt;/P&gt;&lt;P&gt;After the 4.21 release and deprecation of the view based .tsx files, will there be a way to do what I described above: which is to start with an existing widget, subclass it and override things like its render method, or will the code for the out of the box widgets not be available in the same way?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 19:27:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1089028#M74285</guid>
      <dc:creator>FrederickPowers</dc:creator>
      <dc:date>2021-08-13T19:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving imports for widget .tsx files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1089062#M74287</link>
      <description>&lt;P&gt;That approach won't work in the future. The underlying architecture for out-of-the-box widgets is going to change, the specifics are still being worked out. We currently only recommend extending &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Widget.html" target="_self"&gt;Widget&lt;/A&gt; and BaseLayers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 21:51:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/resolving-imports-for-widget-tsx-files/m-p/1089062#M74287</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2021-08-13T21:51:31Z</dc:date>
    </item>
  </channel>
</rss>

