Skip to content

Fix build: maplibre-gl 6 has no default export - #289

Merged
IgnaceMaes merged 1 commit into
ember-learn:mainfrom
NullVoxPopuli-ai-agent:fix-maplibre-gl-6-default-export
Jul 25, 2026
Merged

Fix build: maplibre-gl 6 has no default export#289
IgnaceMaes merged 1 commit into
ember-learn:mainfrom
NullVoxPopuli-ai-agent:fix-maplibre-gl-6-default-export

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown
Contributor

The nightly build has been red on all three channels (release, beta, alpha) since the 2026-07-22 run — the last green one was 2026-07-21.

Cause

maplibre-gl@6.0.0 was published in that window. It ships a pure-ESM build (dist/maplibre-gl.mjs, "type": "module") that exports only named bindings — the default export that v5 provided is gone. Chapter 7 does import maplibregl from 'maplibre-gl', so the app build fails:

[MISSING_EXPORT] "default" is not exported by ".../maplibre-gl@6.0.0/dist/maplibre-gl.mjs".
   ╭─[ app/components/map.gjs:3:8 ]
   │
 3 │ import maplibregl from 'maplibre-gl';
   │        ─────┬────
   │             ╰────── Missing export
───╯

(release fails at the same line, as do beta and alpha.)

Fix

Use a namespace import in the three places chapter 7 shows the import line:

-import maplibregl from 'maplibre-gl';
+import * as maplibregl from 'maplibre-gl';

This is what MapLibre's own README now recommends, and it keeps working on maplibre-gl 5, so the tutorial isn't pinned to a single major. Everything downstream in the chapter is untouched — new maplibregl.Map(...) and new maplibregl.Marker() read exactly the same, so the prose still holds. I added one sentence explaining the * as form, since the tutorial walks through each import.

Verification

The full generator run needs a couple of things my machine doesn't have (tree, and the dev-server readiness handshake didn't settle locally), so I verified against the published output app, ember-learn/super-rentals, which is the exact code this chapter generates:

  1. Installed maplibre-gl@6.0.0 into it and ran pnpm test → reproduced the identical MISSING_EXPORT build failure.
  2. Applied only the import change above → pnpm test passes 25/25, including the four Integration | Component | map tests.
  3. Loaded the app in a browser to confirm this isn't just a build-time fix: the map canvases mount at their configured size and the marker renders, so the chapter screenshots should still be produced.

🤖 Generated with Claude Code

maplibre-gl@6.0.0 ships a pure-ESM build that exports only named
bindings, so `import maplibregl from 'maplibre-gl'` now fails the app
build with:

    [MISSING_EXPORT] "default" is not exported by
    ".../maplibre-gl@6.0.0/dist/maplibre-gl.mjs"
       ╭─[ app/components/map.gjs:3:8 ]

This broke every channel (release, beta and alpha) of the nightly build
starting with the 2026-07-22 run.

Switch the `<Map>` component to a namespace import, which is what
MapLibre's own documentation now recommends, and which keeps working on
maplibre-gl 5 as well. The rest of the chapter is unchanged: the
`maplibregl.Map` / `maplibregl.Marker` usage reads exactly the same.

Verified against the published output app (ember-learn/super-rentals) with
maplibre-gl 6.0.0 installed: `pnpm test` goes from a build failure to
25/25 passing, and the map still renders with its marker in the browser.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@IgnaceMaes
IgnaceMaes merged commit fccf54a into ember-learn:main Jul 25, 2026
6 checks passed
@IgnaceMaes

Copy link
Copy Markdown
Member

Ty mr agent!

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.

2 participants