Get Started with Babel and Webpack
ArcGIS REST JS is ready-to-use with popular module bundlers like webpack and rollup. Make sure you also install the polyfills for fetch
and Promise
. You can find npm install
commands for all packages in the API reference.
npm install @esri/arcgis-rest-request isomorphic-fetch es6-promise
Import the isomorphic-fetch
and es6-promise
polyfills before using ArcGIS REST JS.
import "isomorphic-fetch";
import "es6-promise";
import { request } from "@esri/arcgis-rest-request";
request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
Note: many other libraries or tools (such as Babel) require an ES6 Promise
polyfill. Any Promise
polyfill will work with ArcGIS REST JS, es6-promise
is simply a lightweight standalone version.