Upgrading the ArcGIS Maps SDK for JavaScript from 4.33 to 5.2

This post walks through upgrading an ArcGIS Maps SDK for JavaScript application from 4.33 to 5.2.9, the current release, covering what was removed, what is only deprecated, and the code change for each. The TypeScript before snippets type-check against @arcgis/core@4.33 and the after snippets against @arcgis/core@5.2.9 with @arcgis/map-components@5.2.9.

Which versions you are crossing

The releases between your code and the target are 4.33 (June 2025), 4.34 (October 2025), 5.0 (February 2026), 5.1 (June 2026) and 5.2 (November 2026). Since 5.0 the SDK uses semantic versioning: breaking changes only land in major releases, and minor releases add features and deprecations. The release notes for 5.1 and 5.2 have no breaking-changes section. Apart from a few beta APIs, your real work is in 4.34 and 5.0.

Plan for the next step too. The 5.2 notes call it the last release with widgets and with the popup and default UI on MapView, SceneView and LinkChartView. Version 6.0 (Q1 2027) removes them. Treat the components migration below as required work, even though widget code still compiles on 5.2.

4.33 to 5.2: what moves where 4.33 4.34 5.0 5.1 5.2 6.0 start slots required removals, widgets deprecated deprecations only target Q1 2027: widgets removed 4.33 application AMD require() or ESM + main.css new MapView({ container }) view.ui.add(new Legend(...)) geometryEngineAsync, projection __esri.* global types 5.2 application one module script or npm ESM <arcgis-map> / <arcgis-scene> <arcgis-legend slot="..."> geometry operators (bufferExecute) import type X from "@arcgis/core/..."

The release path from 4.33 to 5.2, and how each part of a widget-based app maps to its 5.x replacement.

Step 1: Loading the SDK

CDN apps

At 5.0 the CDN entry point became a single ES module. It loads core, map components, Calcite and the other component packages. type="module" is required. require() is deprecated since 5.0 and will stop working in 6.0, so switch to $arcgis.import().

<!-- 4.33 -->
<link rel="stylesheet" href="https://js.arcgis.com/4.33/esri/themes/light/main.css" />
<script type="module" src="https://js.arcgis.com/calcite-components/3.2.1/calcite.esm.js"></script>
<script src="https://js.arcgis.com/4.33/"></script>
<script type="module" src="https://js.arcgis.com/4.33/map-components/"></script>
<script>
  require(["esri/Map", "esri/views/MapView"], (Map, MapView) => {
    new MapView({ container: "viewDiv", map: new Map({ basemap: "topo-vector" }) });
  });
</script>
<!-- 5.2 -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<script type="module">
  const [Map, MapView] = await $arcgis.import(["@arcgis/core/Map.js", "@arcgis/core/views/MapView.js"]);
  new MapView({ container: "viewDiv", map: new Map({ basemap: "topo-vector" }) });
</script>

https://js.arcgis.com/5.2/ always points to the latest 5.2 patch. If you want builds you can reproduce, pin a patch such as https://js.arcgis.com/5.2.9/. If you only need the core API, without components, use https://js.arcgis.com/5.2/core.js.

npm apps

Bump every @arcgis/* package to the same version. Map components now also need @arcgis/common-components.

npm install @arcgis/core@5.2 @arcgis/map-components@5.2 @arcgis/common-components@5.2 @esri/calcite-components

Step 2: Widgets to map components

This is the change with the most code. Here is a typical 4.33 setup with a view, a renderer, and widgets placed through view.ui:

// 4.33
import Map from "@arcgis/core/Map";
import MapView from "@arcgis/core/views/MapView";
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
import Legend from "@arcgis/core/widgets/Legend";
import Expand from "@arcgis/core/widgets/Expand";
import Search from "@arcgis/core/widgets/Search";

const layer = new FeatureLayer({ url: "https://example.com/arcgis/rest/services/Assets/FeatureServer/0" });

const view = new MapView({
  container: "viewDiv",
  map: new Map({ basemap: "topo-vector", layers: [layer] }),
  center: [-117.19, 34.05],
  zoom: 12,
});

view.ui.add(new Search({ view }), "top-right");
view.ui.add(new Expand({ view, content: new Legend({ view }), expanded: false }), "bottom-left");

In 5.2 the view and its UI live in markup. Slots replace view.ui.add, and child elements of arcgis-expand become its content:

<arcgis-map basemap="topo-vector" center="-117.19, 34.05" zoom="12">
  <arcgis-search slot="top-right"></arcgis-search>
  <arcgis-expand slot="bottom-left">
    <arcgis-legend></arcgis-legend>
  </arcgis-expand>
</arcgis-map>
// 5.2 (bundler): register the elements you use, then script against them
import "@arcgis/map-components/components/arcgis-map";
import "@arcgis/map-components/components/arcgis-search";
import "@arcgis/map-components/components/arcgis-expand";
import "@arcgis/map-components/components/arcgis-legend";
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
import * as reactiveUtils from "@arcgis/core/core/reactiveUtils";

const viewElement = document.querySelector("arcgis-map")!;
const layer = new FeatureLayer({ url: "https://example.com/arcgis/rest/services/Assets/FeatureServer/0" });

await viewElement.viewOnReady();
viewElement.map?.add(layer);

reactiveUtils.when(() => viewElement.stationary, () => console.log(viewElement.extent?.toJSON()));

The element exposes view properties such as stationary, extent, zoom and highlights directly, and reactiveUtils watches them the same way it watches a view. The underlying MapView is still at viewElement.view when you need whenLayerView() or hitTest(). If your app swaps the map or item-id at runtime, listen for arcgisViewReadyChange, which fires each time a new view is created. viewOnReady() resolves only once.

A note on watchUtils: it was removed before 4.33. It does not exist in the 4.33 package. If your code still imports it, you are on an older API than you think. reactiveUtils has the same signatures in 4.33 and 5.2.

If you already used components in 4.33

Component code has its own breaking changes in 4.34 and 5.0:

  • 4.34: components inside a map no longer get a default position. Give each one a slot, or position it with CSS.
  • 5.0: the arcgis-placement element and the position attribute are gone. Use slot.
  • 5.0: addLayer(), addLayers(), addTable() and addTables() were removed from the map, scene and link chart components. Use map.add(), map.addMany() and map.tables.
  • 5.0: open() and visible on the Popup and Features components were replaced by the open property.
  • 4.34 renames: arcgisSelect became arcgisBookmarkSelect, and closeOnEsc became closeOnEscDisabled.
  • 5.0: state properties no longer reflect to DOM attributes. CSS selectors like arcgis-expand[expanded], and code that reads state through getAttribute or a MutationObserver, silently stop matching. Read the property instead.
// 4.33 component API, removed in 5.0
await viewElement.addLayer(layer);

// 5.x
viewElement.map?.add(layer);

Step 3: Removed core modules

A diff of the two packages' declaration files shows these modules exist in 4.33 and are gone in 5.2: geometry/geometryEngineAsync, geometry/projection, geometry/support/GeographicTransformation and GeographicTransformationStep, the barrel modules geometry, renderers, rasterRenderers, pointCloudRenderers and symbols, the root TimeExtent and TimeInterval, and the old FeatureTable ButtonMenu classes. Here is the 4.33 code compiled against 5.2:

error TS2307: Cannot find module '@arcgis/core/geometry/geometryEngineAsync'
error TS2307: Cannot find module '@arcgis/core/geometry/projection'
error TS2307: Cannot find module '@arcgis/core/geometry'
error TS2307: Cannot find module '@arcgis/core/renderers'
error TS2307: Cannot find module '@arcgis/core/TimeExtent'
error TS2353: 'highlightOptions' does not exist in type 'View2DProperties'
error TS2503: Cannot find namespace '__esri'

Geometry engine and projection

// 4.33
import * as geometryEngineAsync from "@arcgis/core/geometry/geometryEngineAsync";
import * as projection from "@arcgis/core/geometry/projection";
import { Point, SpatialReference } from "@arcgis/core/geometry";

const pt = new Point({ x, y, spatialReference: SpatialReference.WGS84 });
const buffered = (await geometryEngineAsync.geodesicBuffer(pt, 500, "meters")) as __esri.Polygon;
await projection.load();
const projected = projection.project(buffered, SpatialReference.WebMercator);
// 5.2
import Point from "@arcgis/core/geometry/Point";
import SpatialReference from "@arcgis/core/geometry/SpatialReference";
import type Polygon from "@arcgis/core/geometry/Polygon";
import * as geodesicBufferOperator from "@arcgis/core/geometry/operators/geodesicBufferOperator";
import * as projectOperator from "@arcgis/core/geometry/operators/projectOperator";

const pt = new Point({ x, y, spatialReference: SpatialReference.WGS84 });
await Promise.all([geodesicBufferOperator.geodesicBufferLoad(), projectOperator.projectLoad()]);
const buffered = geodesicBufferOperator.geodesicBufferExecute(pt, 500, { unit: "meters" });
const projected = buffered ? (projectOperator.projectExecute(buffered, SpatialReference.WebMercator) as Polygon) : null;

Operators run synchronously once loaded, so the await per call goes away. In 5.2 the generic execute() and load() exports are deprecated in favor of self-describing names such as bufferExecute() and projectLoad(). Both forms work until 6.0.

Barrel imports, TimeExtent and highlights

// 4.33
import { SimpleRenderer } from "@arcgis/core/renderers";
import TimeExtent from "@arcgis/core/TimeExtent";
const view = new MapView({ highlightOptions: { color: "cyan", fillOpacity: 0.2 } });
// 5.2
import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer";
import TimeExtent from "@arcgis/core/time/TimeExtent";
import Collection from "@arcgis/core/core/Collection";
import HighlightOptions from "@arcgis/core/views/support/HighlightOptions";

viewElement.highlights = new Collection([
  new HighlightOptions({ name: "default", color: "cyan", fillOpacity: 0.2 }),
]);

highlights is a Collection. If you assign a plain array in TypeScript, it fails to compile. Other removals in 5.0 to search for: Polygon.isSelfIntersecting (use simplifyOperator.isSimple), ImageryLayer.fetchImage (use fetchPixels), WebStyleSymbol.fetchCIMSymbol() (use fetchSymbol()), Navigation.mouseWheelZoomEnabled (use actionMap.mouseWheel), and dojoConfig.locale. Attribution also moved out of the default UI. Use attributionVisible and attributionItems on the view or element.

Step 4: TypeScript and the __esri namespace

In 4.33 every declaration file imported ./interfaces, so __esri.* types were global as soon as you imported anything. In 5.2 the namespace is deprecated, the module declarations no longer pull it in, and every __esri reference fails with TS2503. Esri ships a codemod that rewrites these references into type imports:

npx @arcgis/codemod run refactor-out-esri-namespace src
npx @arcgis/codemod run geometry-operator-renames src

The codemod edits files in place and has no dry-run mode, so commit before you run it. Its README lists Node.js 24 as a requirement, though both transforms also run under Node 22. If you have to ship before the rewrite is done, a triple-slash reference brings back the global types. It compiles under 5.2, but it is a stopgap only, because the namespace goes away in 6.0:

/// <reference path="../node_modules/@arcgis/core/interfaces.d.ts" />

Step 5: CSS, assets and theming

  • Component-only apps need no SDK stylesheet. Keep esri/themes/light/main.css (or dark) only while widgets remain or while you still create a MapView or SceneView in code.
  • Theme components with Calcite modes, for example <body class="calcite-mode-dark">. 5.0 added the --arcgis-view-color-focus CSS variable for the view focus ring.
  • For npm builds, the default assetsPath is now pinned to the patch release. In 5.2.9 it is https://js.arcgis.com/5.2.9/@arcgis/core/assets, where 4.33 used https://js.arcgis.com/4.33/.... If you self-host assets, set esriConfig.assetsPath and copy the assets again after every patch upgrade.

Step 6: Find the remaining deprecations

Deprecated APIs log a console warning at the warn level when they are used. The message starts with "DEPRECATED" and names the replacement. A deprecated widget points to the matching component element. These warnings are on by default. The esriConfig.log object controls them: level ("none", "error", "warn" or "info", default "warn") and interceptors. Add an interceptor during testing to collect every deprecation in one list:

import esriConfig from "@arcgis/core/config";

const deprecations = new Set<string>();

esriConfig.log.level = "warn";
esriConfig.log.interceptors.push((level, module, ...args) => {
  const text = args.map(String).join(" ");
  if (level === "warn" && text.includes("DEPRECATED")) {
    deprecations.add(`${module}: ${text.split("\n")[0]}`);
  }
  return false; // keep the default console output
});

(globalThis as any).dumpDeprecations = () => console.table([...deprecations]);

Click through the app, then run dumpDeprecations() in the console. Warnings only appear for code paths that actually run, so also search the source for the names in the 5.0, 5.1 and 5.2 release notes. Do not turn the warnings off with esriConfig.has. They are your migration list.

Upgrade checklist

  1. Upgrade on a branch. Set every @arcgis/* package to 5.2.x and add @arcgis/common-components.
  2. CDN: switch to the single type="module" script and replace require() with $arcgis.import().
  3. Run tsc --noEmit and fix the removed modules: operators, direct renderer and geometry imports, time/TimeExtent, and highlights.
  4. Run the refactor-out-esri-namespace and geometry-operator-renames codemods, then review the diff.
  5. Fix component changes: slot instead of position, map.add() instead of addLayer(), and properties instead of reflected attributes.
  6. Replace widgets with components, one panel at a time. Then replace new MapView() with <arcgis-map> and drop main.css.
  7. Add the log interceptor, exercise every screen, and work through the deprecation list.
  8. Check self-hosted assets and pin the CDN patch version in production.

Summary

Going from 4.33 to 5.2 crosses one real breaking release, 5.0, plus the component-placement changes in 4.34. Most compile errors come from removed modules: geometryEngineAsync, projection, the barrel imports and the root TimeExtent. The rest come from the __esri namespace no longer loading by default. The codemod handles most of the TypeScript work, and esriConfig.log.interceptors collects the runtime deprecations. The larger job is moving from widgets and MapView to <arcgis-map> and slotted components. Version 6.0 removes widgets, so do that move now while both models still work side by side.

Comments

Popular posts from this blog

My Cloud Notes

My CSharp Notes