<?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: How exactly should third party libraries be included in WAB through the lib/main? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881957#M14161</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I tried to abbreviate the path to "./proj4js-2.3.14/dist" as you suggested&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp; I am not sure where &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;./proj4js-2.3.14/ is coming from as you said the path was &lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;d:\WAB\client\stmapp\libs\Proj4js\dist\proj4.js.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;My suggestion was: &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;path (&lt;/SPAN&gt;&lt;CODE style="color: #3d3d3d;"&gt;"./proj4js/dist"&lt;/CODE&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Then in your widget code you would use require like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"libs/&lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;proj4js/dist/&lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;proj4" and a parameter of proj4&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2016 12:58:13 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2016-04-07T12:58:13Z</dc:date>
    <item>
      <title>How exactly should third party libraries be included in WAB through the lib/main?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881954#M14158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The official documentation for &lt;A href="https://developers.arcgis.com/web-appbuilder/sample-code/add-a-third-party-library.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;using other libraries in Web AppBuilder&lt;/A&gt; points to &lt;CODE&gt;libs/main&lt;/CODE&gt; for including AMD modules in multiple widgets. I want to use &lt;A href="https://github.com/proj4js/proj4js/releases" rel="nofollow noopener noreferrer" target="_blank"&gt;Proj4js&lt;/A&gt; in my widgets, so I deployed it in the &lt;CODE&gt;d:\WAB\client\stmapp\libs&lt;/CODE&gt; directory and added the path (&lt;CODE&gt;"./proj4js/dist/proj4"&lt;/CODE&gt;) into the &lt;CODE&gt;libs/main.js&lt;/CODE&gt; dependency array. The path to the &lt;CODE&gt;proj4.js&lt;/CODE&gt; file is &lt;CODE&gt;d:\WAB\client\stmapp\libs\Proj4js\dist\proj4.js&lt;/CODE&gt;, which should be where the setting is pointing to. This should be enough according to the documentation, but it doesn't work. &lt;CODE&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fmyname%2Fwebappviewer%2F%3Fconfig%3Dsample-configs%2Fconfig-demo.json" target="_blank"&gt;http://myname/webappviewer/?config=sample-configs/config-demo.json&lt;/A&gt;&lt;/CODE&gt; reads code from the client, so the problem shouldn't be in reading wrong address, but to be sure I copied the code to all WAB apps where I have the widget as well (stem app + all my apps).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/162440" target="_blank"&gt;Someone had a similar problem&lt;/A&gt; and solved it, though he asked for a non-AMD module and &lt;CODE&gt;proj4js&lt;/CODE&gt; seems to be AMD-compliant, so his solution is unlikely to work for me. I tried everything they suggested there. I added &lt;CODE&gt;window.path + 'libs/proj4js/dist/proj4.js'&lt;/CODE&gt; into the &lt;CODE&gt;resources&lt;/CODE&gt; array in the &lt;CODE&gt;Init.js&lt;/CODE&gt; file - this is suggested for static sources, but probably helped that guy. In the same file, I created &lt;CODE&gt;dojoConfig.aliases&lt;/CODE&gt; with reference for &lt;CODE&gt;proj4js&lt;/CODE&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;dojoConfig.aliases = [
&amp;nbsp; ['Proj4js', 'libs/proj4js/dist/proj4']
];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I defined the library by the alias, but the first use of Proj4js in the code throws a "not found error" - obviously the alias is not recognized. I didn't find any other address to define the library in my widget which wouldn't throw the same error. In the linked discussion they omitted the definition, but I don't think it's the solution in my case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;define([
&amp;nbsp; //other libraries
&amp;nbsp; "Proj4js"
],
function (
&amp;nbsp; //other libraries
&amp;nbsp; Proj4js
) {
&amp;nbsp; //other code

&amp;nbsp; //Proj4js unknown error here if definition omitted
&amp;nbsp; Proj4js.defs["EPSG:102067"] = "S-JTSK Krovak Proj4js definition";

&amp;nbsp; //the rest of my code
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I intend to use this for multiple (perhaps even tens in the future) widgets, so I want to learn the lib/main methods even though I managed to enable proj4js for a single module. I deployed proj4js in my widget and defined it by relative path in my code: &lt;CODE&gt;"./proj4js-2.3.14/dist/Proj4"&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This question is based on my older GIS.stackexchange question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 11:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881954#M14158</guid>
      <dc:creator>PavelVeselský1</dc:creator>
      <dc:date>2021-12-12T11:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How exactly should third party libraries be included in WAB through the lib/main?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881955#M14159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;so I deployed it in the &lt;/SPAN&gt;&lt;CODE style="color: #3d3d3d;"&gt;d:\WAB\client\stmapp\libs&lt;/CODE&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; directory and added the path (&lt;/SPAN&gt;&lt;CODE style="color: #3d3d3d;"&gt;"./proj4js/dist/proj4"&lt;/CODE&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;) into the &lt;/SPAN&gt;&lt;CODE style="color: #3d3d3d;"&gt;libs/main.js&lt;/CODE&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; dependency array.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I think you have gone to deep with your path when adding it to the main.js dependency array. Try:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;path (&lt;/SPAN&gt;&lt;CODE style="color: #3d3d3d;"&gt;"./proj4js/dist"&lt;/CODE&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;) instead as the proj4 is the actual js file and all the path should be is the folders.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2016 20:11:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881955#M14159</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-04-06T20:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How exactly should third party libraries be included in WAB through the lib/main?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881956#M14160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried to abbreviate the path to "./proj4js-2.3.14/dist" as you suggested, but I got an error: &lt;SPAN class="objectBox-string objectBox"&gt;&lt;SPAN&gt;"NetworkError: 404 Not Found - &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fmyname%3A3344%2Fwebappviewer%2Fwidgets%2FMyWidget%2Fproj4js-2.3.14%2Fdist.js" rel="nofollow" target="_blank"&gt;http://myname:3344/webappviewer/widgets/MyWidget/proj4js-2.3.14/dist.js&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="objectBox-string objectBox"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="objectBox-string objectBox"&gt;I don't know why my Dojo expects a .js file, but it does.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 11:44:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881956#M14160</guid>
      <dc:creator>PavelVeselský1</dc:creator>
      <dc:date>2016-04-07T11:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How exactly should third party libraries be included in WAB through the lib/main?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881957#M14161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I tried to abbreviate the path to "./proj4js-2.3.14/dist" as you suggested&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp; I am not sure where &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;./proj4js-2.3.14/ is coming from as you said the path was &lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;d:\WAB\client\stmapp\libs\Proj4js\dist\proj4.js.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;My suggestion was: &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;path (&lt;/SPAN&gt;&lt;CODE style="color: #3d3d3d;"&gt;"./proj4js/dist"&lt;/CODE&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Then in your widget code you would use require like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"libs/&lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;proj4js/dist/&lt;SPAN style="color: #3d3d3d; font-family: monospace;"&gt;proj4" and a parameter of proj4&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 12:58:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881957#M14161</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-04-07T12:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: How exactly should third party libraries be included in WAB through the lib/main?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881958#M14162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pavel,&lt;/P&gt;&lt;P&gt;I don't know if it can help you but I asked a similar question &lt;A _jive_internal="true" href="https://community.esri.com/thread/162440"&gt;here&lt;/A&gt; !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2016 07:47:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-exactly-should-third-party-libraries-be/m-p/881958#M14162</guid>
      <dc:creator>FlorianCADOZ</dc:creator>
      <dc:date>2016-04-25T07:47:26Z</dc:date>
    </item>
  </channel>
</rss>

