I've been working on a project using Next.js with the ArcGIS API but ultimately reverted to using TanStack Router with Vite due to significant developer experience issues. While the production build works fine, the development process has been extremely frustrating.
Project Context
Key Issues with Next.js
- Slow development process compared to other mapping libraries – Any change to a component triggers a full rebuild, taking 40–60 seconds, and requires a manual page refresh to see updates. In contrast, Vite's dependency pre-building enables near-instant updates without a full rebuild. I've built highly interactive mapping applications with Next.js before (e.g. icelogistics.info/antarctic) using Leaflet, but the experience with ArcGIS has been significantly slower.
- Turbopack incompatibility – Some ArcGIS packages depend on Stencil.js, which uses dynamic imports and custom Webpack comments that fail to compile in Turbopack.
Questions
- Has anyone successfully optimised the development experience of using Next.js with the ArcGIS API?
- Are there any known workarounds for handling Stencil.js dependencies in Next.js/Turbopack?
- Is there any active work being done to improve ArcGIS compatibility with frameworks like Next.js? Will this get better in the future, or would the advice be to avoid it where possible?
I’d prefer to continue using Next.js, but the current ArcGIS compatibility issues make it challenging. Any insights or workarounds would be greatly appreciated!