MapLibre 6 is ESM-only and drops its default export, so internal imports switched to namespace imports. Vite users must import maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url and pass the result to maplibregl.setWorkerUrl() before creating a map. This can be done in a <script module> tag in your Map component or anywhere else in your application that loads before it.
Breaking changes to this library's own API:
StyleLoadEventis now an alias for MapLibre'sMapStyleLoadEvent. It no longer hasmapandstyleproperties — those never existed at runtime — and carriestargetinstead.- The
zoomstart,zoom,zoomend,pitchandrotatehandlers onMapLibreandMapEventsnow receiveMapMovementEvent. They were previously typed asMapLibreZoomEvent, which MapLibre 6 renamed toMapBoxZoomEventand which only ever described box-zoom events. - The
datahandler onMapLibreandMapEventsnow receivesMapSourceDataEvent | MapStyleDataEvent;MapDataEventwas removed from MapLibre. Popup'sonhoverprop was removed. It listened for ahoverevent that MapLibre'sPopupnever fires, so it never ran. UseopenOn="hover"withonopen.Layer'spaintandlayoutprops are typed asAllPaintProperties/AllLayoutPropertiesinstead ofobject, following MapLibre 6's typedsetPaintProperty/setLayoutProperty.RasterDEMTileSource'sencodingprop is typed asRasterDEMSourceSpecification['encoding'], since MapLibre does not exportDEMEncoding.
New in this release:
MapLibreaccepts azoomLevelsToOverscaleprop. MapLibre 6 changed this option's default to 4, which splits vector tiles above a source'smaxzoomrather than overscaling them; that improves labeling but slightly alters rendering andqueryRenderedFeaturesresults. Passnullto overscale at every zoom level, as MapLibre 5 did.
What's Changed
- Support
maplibre-glv6 by @firatciftci in #303
New Contributors
- @firatciftci made their first contribution in #303
Full Changelog: v1.3.0...v2.0.0