Skip to content

fix: repair gauche wasm visualization by pinning maplibre-gl - #47

Merged
DennisOSRM merged 1 commit into
masterfrom
fix/gauche-wasm-map-maplibre-pin
Aug 27, 2026
Merged

fix: repair gauche wasm visualization by pinning maplibre-gl#47
DennisOSRM merged 1 commit into
masterfrom
fix/gauche-wasm-map-maplibre-pin

Conversation

@DennisOSRM

Copy link
Copy Markdown
Contributor

Companion to Project-OSRM/gauche-rs#4. Deploys the fix for the live gauche visualization.

Problem

The hosted gauche-wasm-map.html is broken — blank page, console shows:

Uncaught ReferenceError: maplibregl is not defined

Root cause

The page loaded MapLibre GL JS from unpkg with a floating version:

<script src="https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js"></script>

MapLibre GL JS v6 dropped the UMD build. @latest now resolves to 6.6.0, where dist/maplibre-gl.js returns 404 — v6 is ESM-only (exports provides only importdist/maplibre-gl.mjs, no main/browser fields).

So the script tag 404s, the maplibregl global is never created, and new maplibregl.Map(...) throws. Nothing here changed — the page broke the moment MapLibre published v6.

The WebAssembly is not at fault. Verified independently: the embedded module instantiates with zero imports and classifies correctly.

Change

This is a flat file copied from gauche-rs. Overwritten wholesale with the freshly generated artifact from Project-OSRM/gauche-rs#4, which pins both the JS and CSS to 5.24.0 (last release shipping the UMD build).

Byte-identical to dist/gauche-wasm-map.html on that branch.

Two things move in this diff

  1. The maplibre-gl pin@latest@5.24.0. This is the actual fix.
  2. The embedded wasm blob — the copy served until now predated gauche-rs 459f467. It exported only classify_point_wasm and initialize_index_wasm; the new build additionally exports classify_line_wasm and classify_bbox_wasm. This page uses neither, so it is inert here — noting it so the blob change in the diff is accounted for.

Verification

Served this exact file over local HTTP and drove it in a browser:

  • typeof maplibregl"object"; canvas renders; demotiles style, tiles and fonts all return 200
  • status reaches Ready. Click to classify traffic side.
  • central England → 52.820224, -1.601076 -> left-hand traffic (blue dot)
  • France → 46.939984, 1.914549 -> right-hand traffic (orange dot)

Merge order

Either order works — the file here is self-contained and does not depend on gauche-rs#4 landing first. Merging gauche-rs#4 keeps the generator and this copy in sync for the next regeneration.

The served `gauche-wasm-map.html` loaded MapLibre GL JS from unpkg with a
floating `@latest` version. MapLibre v6 dropped the UMD build entirely: it
is now ESM-only, so `dist/maplibre-gl.js` returns HTTP 404. The script tag
failed to load, the `maplibregl` global was never defined, and the page
died with `Uncaught ReferenceError: maplibregl is not defined`.

Overwrite the flat file with the freshly generated artifact from
gauche-rs, which pins maplibre-gl to 5.24.0 (last release shipping UMD).

The embedded wasm blob also advances: the copy served until now predated
gauche-rs 459f467, so it exported only classify_point_wasm and
initialize_index_wasm. The new build additionally exports
classify_line_wasm and classify_bbox_wasm, which this page does not use.

Verified end-to-end in a browser: basemap renders, the module reports
ready, central England classifies as left-hand traffic and France as
right-hand traffic.

Upstream fix: Project-OSRM/gauche-rs#4

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P17bfPsp1pf8qQq8bTL9Rs
@DennisOSRM
DennisOSRM merged commit 99b436c into master Aug 27, 2026
2 checks passed
@DennisOSRM
DennisOSRM deleted the fix/gauche-wasm-map-maplibre-pin branch August 27, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant