Skip to content

Deferred: maplibre-gl 5 → 6 upgrade (breaking: default-import removed + leaflet adapter has no v6 release) #4650

Description

@Yeraze

Dependabot opened #4646 for maplibre-gl 5.24.0 → 6.2.0. Closed and ignored (see `.github/dependabot.yml` update); tracking here so the eventual upgrade lands deliberately.

Blockers

1. `@maplibre/maplibre-gl-leaflet` has no v6 support

The leaflet adapter we use for `VectorTileLayer` (`src/components/VectorTileLayer.tsx`) is stuck at 0.1.3 — no release for a year — and its peer range explicitly stops at v5:

```
"maplibre-gl": "^2.4.0 || ^3.3.1 || ^4.3.2 || ^5.0.0"
```

We can't move to v6 unless one of:

Upstream tracking: watch `@maplibre/maplibre-gl-leaflet` releases for a version bump. If the project stays dormant, plan for the rewrite instead.

2. Default import gone (ESM-only v6)

CI on #4646 failed on this — dependabot's diff, unmodified, hits:

```
error TS1192: Module '.../maplibre-gl/dist/maplibre-gl' has no default export.
src/components/map/Base3DMap.tsx
src/components/MapAnalysis/Follow3DController.tsx
src/components/MapAnalysis/MapAnalysisCanvas.tsx
```

Codemod is small — swap `import maplibregl from 'maplibre-gl'` for `import * as maplibregl from 'maplibre-gl'` (or named imports) — but has to happen in the same PR as the version bump, or CI stays red.

3. Other breaking changes to walk through

From the v5→v6 migration guide:

  • `Map` composes `Camera` instead of extending it — `map.transform` is gone, use the public API.
  • All events are real classes now; `MapDataEvent` split into `MapSourceDataEvent | MapStyleDataEvent`.
  • `styleimagemissing` is notify-only — supply images via `Map.setMissingStyleImageResolver`.
  • `GeoJSONSource.setData` no longer takes `waitForCompletion` and doesn't return `this`.
  • Style spec v25 throws warnings on legacy expressions.
  • `zoomLevelsToOverscale` default changed to 4 (affects `queryRenderedFeatures` and some label placement).

Each needs verification against our actual usage in 3D map / analysis canvas / follow controller.

Suggested unblock plan

  1. Open an issue on `@maplibre/maplibre-gl-leaflet` requesting v6 support (or check if one exists).
  2. If dormant, scope the `VectorTileLayer` rewrite as a prerequisite.
  3. Only then land maplibre-gl 6, in the same PR as the import codemod + Map/event/style-spec fixes, verified against the 3D map surface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions