Install and set up

Accessing the API

There are multiple options for bringing the ArcGIS Maps SDK for JavaScript into your app. Read more about AMD and ES modules in Introduction to Tooling.

AMD modules via ArcGIS CDN

The most common approach for accessing the API is to use the hosted version. Reference the API and CSS from our CDN to start using the API in your app.

Use dark colors for code blocksCopy
1
2
<link rel="stylesheet" href="https://js.arcgis.com/4.29/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.29/"></script>

ES modules via NPM

The API is also available as ES modules via npm, a JavaScript package manager. You can install the API locally for use with JavaScript frameworks such as React and Angular, and with module bundlers such as webpack or rollup.js.

To install:

Use dark colors for code blocksCopy
1
npm install @arcgis/core

Then import modules:

Use dark colors for code blocksCopy
1
import Map from "@arcgis/core/Map.js";

And, for the CSS use @import url:

Use dark colors for code blocksCopy
1
2
/* CSS url as a string */
@import "https://js.arcgis.com/4.29/@arcgis/core/assets/esri/themes/light/main.css";

For more information, see these guides:

ES modules via CDN

Note: This approach is currently only recommended for development and prototyping.

Use dark colors for code blocksCopy
1
2
3
4
5
6
<link rel="stylesheet" href="https://js.arcgis.com/4.29/@arcgis/core/assets/esri/themes/light/main.css">
<script type="module">
  import Map from "https://js.arcgis.com/4.29/@arcgis/core/Map.js";

  // Use the Map class
</script>

AMD modules hosted locally

In some cases, you may need to use a locally hosted version of the AMD modules via ArcGIS CDN. An example of this is when you are working in a restricted network environment with no internet access. You can also download and install the documentation which includes the API Reference, tutorials, and samples. The documentation available for download is a snapshot from the release date of version 4.29 and will not include the latest sample updates, documentation fixes, etc.

  • To download the ArcGIS Maps SDK for JavaScript and its documentation, navigate to the ArcGIS Maps SDK for JavaScript download page.

Web server hosting configuration

The web server hosting configuration where you host the ArcGIS Maps SDK for JavaScript will need the following MIME/type registration.

extensionMIME/typeDescription
.ttfapplication/octet-streamTrue Type Fonts
.wasmapplication/wasmWebAssembly
.woffapplication/font-woffWeb Open Font Format
.woff2application/font-woff2WOFF File Format 2.0
.wsvapplication/octet-streamSupports SceneView's stars visualization
.pbfapplication/x-protobufFonts for MapView labeling for some layers

Note that a web server supporting HTTPS requires the web server to use an SSL web server certificate.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.