These examples are split by adapter. MapLibre is the default; Leaflet is provided for compatibility.
examples/maplibre/ – MapLibre GL JS demos (default)examples/leaflet/ – Leaflet demos (compatibility)npm run examples:browser
Open in your browser:
http://localhost:4173/examples/maplibre/index.htmlhttp://localhost:4173/examples/maplibre/indonesia/index.htmlhttp://localhost:4173/examples/maplibre/projections/index.htmlhttp://localhost:4173/examples/leaflet/index.htmlhttp://localhost:4173/examples/leaflet/zoom-scaling-glyphs.htmlAll examples use import maps. Ensure the following mappings (adjust as needed):
<script type="importmap">
{
"imports": {
"leaflet": "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/+esm",
"npm:leaflet": "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/+esm",
"maplibre-gl": "https://esm.sh/maplibre-gl@5.8.0?bundle",
"@turf/turf": "https://esm.sh/@turf/turf@6.5.0?bundle",
"@turf/helpers": "https://esm.sh/@turf/helpers@6.5.0?bundle",
"flubber": "https://esm.sh/flubber@0.4.2?bundle",
"lodash/isEmpty.js": "https://esm.sh/lodash@4.17.21/isEmpty?bundle",
"lodash/cloneDeep.js": "https://esm.sh/lodash@4.17.21/cloneDeep?bundle",
"lodash/keyBy.js": "https://esm.sh/lodash@4.17.21/keyBy?bundle",
"lodash/mapValues.js": "https://esm.sh/lodash@4.17.21/mapValues?bundle"
}
}
</script>
Notes:
@turf/turf and flubber must use esm.sh with ?bundle.+esm.