<?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 Running local with separate files using the new CDN in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649435#M87603</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I've been teaching the Maps SDK for JS for a while now, but it's been a couple years since I last did so, and boy has a lot changed! I'm used to using the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;require([],()=&amp;gt;{})&lt;/FONT&gt;&amp;nbsp;function to bring in the modules that I'll be using, and running my files locally using separate html, javascript, and css files. This seems to no longer be supported by the API reference documentation. I think if I can get a basic web map working locally with separate files, I should be good to go. Any help is much appreciated!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!doctype html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /&amp;gt;
    &amp;lt;title&amp;gt;Intro to MapView - Create a 2D map | Sample | ArcGIS Maps SDK for JavaScript 4.33&amp;lt;/title&amp;gt;
    
    &amp;lt;!-- Load required JS SDK stylesheet, contains the CSS for various widgets and the map itself --&amp;gt;
    &amp;lt;link rel="stylesheet" type="text/css" href="https://js.arcgis.com/4.33/esri/themes/light/main.css"&amp;gt;
    &amp;lt;!-- use a local stylesheet as well for the div containing the map --&amp;gt;
    &amp;lt;link rel="stylesheet" type="text/css" href="./style.css" /&amp;gt;

    &amp;lt;!-- specify the JavaScript ArcGIS SDK --&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.33/"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- specify the local JavaScript file to load a web map into viewDiv --&amp;gt;
    &amp;lt;script type="module" src="./script.js"&amp;gt;&amp;lt;/script&amp;gt;

  &amp;lt;body&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;// Load the Map and MapView modules
// require(["esri/Map", "esri/views/MapView"], (Map, MapView) =&amp;gt; {
const [Map, MapView] = await $arcgis.import([
  "@arcgis/core/Map.js",
  "@arcgis/core/views/MapView.js",
]);

const myMap = new Map({
  basemap: "topo-vector",
});

const myView = new MapView({
  container: "viewDiv",
  map: myMap,
  zoom: 4,
  center: [15, 65], // longitude, latitude
});
//});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Sep 2025 17:35:16 GMT</pubDate>
    <dc:creator>AntonioMedrano</dc:creator>
    <dc:date>2025-09-10T17:35:16Z</dc:date>
    <item>
      <title>Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649435#M87603</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I've been teaching the Maps SDK for JS for a while now, but it's been a couple years since I last did so, and boy has a lot changed! I'm used to using the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;require([],()=&amp;gt;{})&lt;/FONT&gt;&amp;nbsp;function to bring in the modules that I'll be using, and running my files locally using separate html, javascript, and css files. This seems to no longer be supported by the API reference documentation. I think if I can get a basic web map working locally with separate files, I should be good to go. Any help is much appreciated!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!doctype html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /&amp;gt;
    &amp;lt;title&amp;gt;Intro to MapView - Create a 2D map | Sample | ArcGIS Maps SDK for JavaScript 4.33&amp;lt;/title&amp;gt;
    
    &amp;lt;!-- Load required JS SDK stylesheet, contains the CSS for various widgets and the map itself --&amp;gt;
    &amp;lt;link rel="stylesheet" type="text/css" href="https://js.arcgis.com/4.33/esri/themes/light/main.css"&amp;gt;
    &amp;lt;!-- use a local stylesheet as well for the div containing the map --&amp;gt;
    &amp;lt;link rel="stylesheet" type="text/css" href="./style.css" /&amp;gt;

    &amp;lt;!-- specify the JavaScript ArcGIS SDK --&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.33/"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- specify the local JavaScript file to load a web map into viewDiv --&amp;gt;
    &amp;lt;script type="module" src="./script.js"&amp;gt;&amp;lt;/script&amp;gt;

  &amp;lt;body&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;// Load the Map and MapView modules
// require(["esri/Map", "esri/views/MapView"], (Map, MapView) =&amp;gt; {
const [Map, MapView] = await $arcgis.import([
  "@arcgis/core/Map.js",
  "@arcgis/core/views/MapView.js",
]);

const myMap = new Map({
  basemap: "topo-vector",
});

const myView = new MapView({
  container: "viewDiv",
  map: myMap,
  zoom: 4,
  center: [15, 65], // longitude, latitude
});
//});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 17:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649435#M87603</guid>
      <dc:creator>AntonioMedrano</dc:creator>
      <dc:date>2025-09-10T17:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649443#M87604</link>
      <description>&lt;P&gt;When I run your files locally, I receive a CORS error (not too surprising).&amp;nbsp; Rather than try and bypass that (you'd want to setup a 'local webhost'), it was just as easy to throw those files out on GitHub: I don't see any errors?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://daneatkins-github.github.io/DemoPage/index.html" target="_blank" rel="noopener"&gt;Intro to MapView - Create a 2D map | Sample | ArcGIS Maps SDK for JavaScript 4.33&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://daneatkins-github.github.io/DemoPage/index.html" target="_blank" rel="noopener"&gt;https://daneatkins-github.github.io/DemoPage/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 17:22:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649443#M87604</guid>
      <dc:creator>D_Atkins</dc:creator>
      <dc:date>2025-09-10T17:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649447#M87605</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/426788"&gt;@AntonioMedrano&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I would start making the transition to the map components API rather than creating the MapView programmatically.&amp;nbsp; Something like this should work and easy to build from.&lt;/P&gt;&lt;P&gt;index.html&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
    &amp;lt;title&amp;gt;CDN APP&amp;lt;/title&amp;gt;
    &amp;lt;!-- Load Calcite Design System --&amp;gt;
    &amp;lt;script
      type="module"
      src="https://js.arcgis.com/calcite-components/3.2.1/calcite.esm.js"
    &amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load the JavaScript Maps SDK core API --&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://js.arcgis.com/4.33/esri/themes/light/main.css"
    /&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.33/"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load the JavaScript Maps SDK Map components or other component packages --&amp;gt;
    &amp;lt;script
      type="module"
      src="https://js.arcgis.com/4.33/map-components/"
    &amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load the styles.css file --&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles.css" /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;arcgis-map item-id="237b9584339446a0b56317b5962a4971"&amp;gt;
      &amp;lt;arcgis-zoom position="top-left"&amp;gt;&amp;lt;/arcgis-zoom&amp;gt;
      &amp;lt;arcgis-legend position="bottom-right"&amp;gt;&amp;lt;/arcgis-legend&amp;gt;
    &amp;lt;/arcgis-map&amp;gt;

    &amp;lt;!-- Load the main.js file --&amp;gt;
    &amp;lt;script type="module" src="main.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;main.js&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const mapElement = document.querySelector("arcgis-map");

await mapElement.viewOnReady();
console.log("The map view is ready!");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;styles.css&lt;/P&gt;&lt;LI-CODE lang="css"&gt;html,
body {
  height: 100%;
  margin: 0;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Sep 2025 17:32:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649447#M87605</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2025-09-10T17:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649466#M87606</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/intro-mapview/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/intro-mapview/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;ESRI is moving away from it, so maybe it's not the best choice for a new application, but the require() syntax is still valid as of 4.33.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 18:02:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649466#M87606</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2025-09-10T18:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649489#M87607</link>
      <description>&lt;P&gt;Thanks for the reply! Unfortunately this gets a CORS error when run locally. I was taught that it was always good to separate your HTML, JS, and CSS, but I think the &lt;FONT face="courier new,courier"&gt;&amp;lt;script type="module" ...&amp;gt;&lt;/FONT&gt; seems to make that not work locally. For teaching absolute beginners, is it preferred now to just keep everything in one HTML file?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 19:11:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649489#M87607</guid>
      <dc:creator>AntonioMedrano</dc:creator>
      <dc:date>2025-09-10T19:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649570#M87609</link>
      <description>&lt;P&gt;You're right, scripts seem to be blocked from local file paths due to a CORS error when you try to open the HTML file directly in a browser. It's now considered best practice to host your files on a local web server, and in many cases, it's necessary.&lt;/P&gt;&lt;P&gt;There are many options available, from using a full-fledged server like Apache or IIS to something more temporary. For quick local hosting, I find these options useful, they are not official esri recommendations or products:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Live Server for VS Code:&lt;/STRONG&gt; This is a free extension that makes it easy to host your current directory. It also automatically refreshes the browser when you save your files. You can find it on the &lt;A href="https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer" target="_blank" rel="noopener"&gt;Visual Studio Marketplace&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;http-server:&lt;/STRONG&gt; This is a simple, zero-configuration command-line HTTP server that you can install via npm. You can find the package and installation instructions on the &lt;A href="https://www.npmjs.com/package/http-server" target="_blank" rel="noopener"&gt;npm website&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 10 Sep 2025 22:10:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649570#M87609</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2025-09-10T22:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Running local with separate files using the new CDN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649584#M87610</link>
      <description>&lt;P&gt;You should also be able to host on github pages, but that's not ideal for development.&amp;nbsp; This is the same app above hosted on github.&lt;/P&gt;&lt;P&gt;&lt;A href="https://sagewall.github.io/cdn-app-template/" target="_blank"&gt;https://sagewall.github.io/cdn-app-template/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/sagewall/cdn-app-template" target="_blank"&gt;https://github.com/sagewall/cdn-app-template&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 22:34:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/running-local-with-separate-files-using-the-new/m-p/1649584#M87610</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2025-09-10T22:34:59Z</dc:date>
    </item>
  </channel>
</rss>

