MapLibre GL JS 6.0: ESM-Only, WebGL2-Required, and Finally Mapbox-Free
Last week’s major MapLibre GL JS release, which contains a whopping sixteen breaking changes and removes the last remaining references to Mapbox, marking the full emancipation from the library’s origins.
Other key highlights include:
- Switch to an ESM-only distribution (
maplibre-gl.mjs). The UMD bundles (maplibre-gl.js,maplibre-gl-csp.js) are no longer published. […] Consumers using<script src=".../maplibre-gl.js">must switch to<script type="module">, and consumers usingimport maplibregl from 'maplibre-gl'must switch toimport * as maplibregl from 'maplibre-gl'or named imports.Mapnow composes aCamerainstead of extending it (MapextendsEventeddirectly and forwards the camera API). The internal map.transform was removed — use map’s public API instead or open a PR if you need something that’s not exposed.- The TypeScript target has been updated to ES2022. This results in smaller bundles and improved runtime performance by relying on modern JavaScript features and reducing transpilation. Consumers targeting browsers or using some tooling released before 2022 may need to transpile MapLibre or update.
- WebGL (v1) support has been removed; WebGL2 is now required. In practical terms, this will not change how you interact with the map. This enables performance improvements (e.g. line opacity), Terrain3D enhancements, and several bug fixes. WebGL2 support has been widely available for years, and usage of the legacy path had plateaued, so maintaining it no longer justified the added complexity.
Follow the upgrade guide to mitigate breaking changes.