<?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: &amp;quot;ReferenceError: document is not defined&amp;quot; occurred when generate custom build of API in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/quot-referenceerror-document-is-not-defined-quot/m-p/516798#M48225</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At this point I don't think it's viable to be able to use RequireJS optimizer to build 4x. It should still work fine in 3x, but there are too many pieces in 4x that reference the document property right now to make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the error above you need to add&amp;nbsp;&lt;SPAN style="background-color: #f6f6f6;"&gt;dojo/dom-construct&lt;/SPAN&gt; to the list of excluded features. But then you may hit another error that will require you to add more files to the list of excluded features and the number of files that will be required to dynamically load will just grow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Dojo build works fine, but RequireJS does not have the tooling that the Dojo build system has to work around this particular issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With some new tooling we're adding in as well, I don't think RequireJS optimizer can continue to be a build target for 4x.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Mar 2018 21:35:09 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2018-03-19T21:35:09Z</dc:date>
    <item>
      <title>"ReferenceError: document is not defined" occurred when generate custom build of API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/quot-referenceerror-document-is-not-defined-quot/m-p/516797#M48224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm following this instruction(&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/guide/using-bower/index.html" title="https://developers.arcgis.com/javascript/latest/guide/using-bower/index.html"&gt;Using Bower for Custom Builds | ArcGIS API for JavaScript 4.6&lt;/A&gt;&amp;nbsp;) to generate&amp;nbsp;a custom build(RequireJS) of API, but this error occured:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running "requirejs:single" (requirejs) task&lt;BR /&gt;ReferenceError: document is not defined&lt;BR /&gt;In module tree:&lt;BR /&gt; dojo/NodeList-dom&lt;BR /&gt; dojo/dom-construct&lt;BR /&gt; dojo/dom-attr&lt;BR /&gt; dojo/dom-prop&lt;BR /&gt; dojo/_base/connect&lt;BR /&gt; dojo/on&lt;BR /&gt; dojo/has&lt;/P&gt;&lt;P&gt;{ Error: ReferenceError: document is not defined&lt;BR /&gt;In module tree:&lt;BR /&gt; dojo/NodeList-dom&lt;BR /&gt; dojo/dom-construct&lt;BR /&gt; dojo/dom-attr&lt;BR /&gt; dojo/dom-prop&lt;BR /&gt; dojo/_base/connect&lt;BR /&gt; dojo/on&lt;BR /&gt; dojo/has&lt;/P&gt;&lt;P&gt;at /Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:28326:19&lt;BR /&gt; at /Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:3059:39&lt;BR /&gt; at /Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:2999:25&lt;BR /&gt; at Function.prim.nextTick (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:28077:9)&lt;BR /&gt; at Object.errback (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:2998:26)&lt;BR /&gt; at Object.callback (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:2984:23)&lt;BR /&gt; at Object.then (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:3038:23)&lt;BR /&gt; at build (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:28283:12)&lt;BR /&gt; at runBuild (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:30291:17)&lt;BR /&gt; at Object.execCb (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:1946:33)&lt;BR /&gt; at Module.check (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:1133:51)&lt;BR /&gt; at Module.enable (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:1426:22)&lt;BR /&gt; at Module.init (/Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:1038:26)&lt;BR /&gt; at /Users/Nie/custom-jsapi/4.x/bower/requirejs/node_modules/requirejs/bin/r.js:1710:36&lt;BR /&gt; at _combinedTickCallback (internal/process/next_tick.js:131:7)&lt;BR /&gt; at process._tickCallback (internal/process/next_tick.js:180:9)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm working on a Mac and installed these tools:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;➜ requirejs git:(master) ✗ node --version&lt;BR /&gt;v9.1.0&lt;BR /&gt;➜ requirejs git:(master) ✗ git --version&lt;BR /&gt;git version 2.10.1&lt;BR /&gt;➜ requirejs git:(master) ✗ grunt --version&lt;BR /&gt;grunt-cli v1.2.0&lt;BR /&gt;grunt v1.0.2&lt;BR /&gt;➜ requirejs git:(master) ✗ bower --version&lt;BR /&gt;1.8.2&lt;BR /&gt;➜ requirejs git:(master) ✗ java -version&lt;BR /&gt;java version "1.8.0_45"&lt;BR /&gt;Java(TM) SE Runtime Environment (build 1.8.0_45-b14)&lt;BR /&gt;Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;After git clone from GitHub, I have executed 'npm install' and added these&amp;nbsp;lines at the top of app/main.js:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var dojoConfig = {&lt;BR /&gt; baseUrl: '.',&lt;BR /&gt; packages: [&lt;BR /&gt; 'app',&lt;BR /&gt; 'dijit',&lt;BR /&gt; 'dojo',&lt;BR /&gt; 'dojox',&lt;BR /&gt; 'dstore',&lt;BR /&gt; 'dgrid',&lt;BR /&gt; 'esri'&lt;BR /&gt; ]&lt;BR /&gt;};&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then this error occurred when execute 'npm run build'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone has some clues?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 05:57:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/quot-referenceerror-document-is-not-defined-quot/m-p/516797#M48224</guid>
      <dc:creator>nie</dc:creator>
      <dc:date>2018-03-19T05:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: "ReferenceError: document is not defined" occurred when generate custom build of API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/quot-referenceerror-document-is-not-defined-quot/m-p/516798#M48225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At this point I don't think it's viable to be able to use RequireJS optimizer to build 4x. It should still work fine in 3x, but there are too many pieces in 4x that reference the document property right now to make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the error above you need to add&amp;nbsp;&lt;SPAN style="background-color: #f6f6f6;"&gt;dojo/dom-construct&lt;/SPAN&gt; to the list of excluded features. But then you may hit another error that will require you to add more files to the list of excluded features and the number of files that will be required to dynamically load will just grow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Dojo build works fine, but RequireJS does not have the tooling that the Dojo build system has to work around this particular issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With some new tooling we're adding in as well, I don't think RequireJS optimizer can continue to be a build target for 4x.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 21:35:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/quot-referenceerror-document-is-not-defined-quot/m-p/516798#M48225</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2018-03-19T21:35:09Z</dc:date>
    </item>
  </channel>
</rss>

