maplibre-gl 6.18.0 with Vite 8 dev: `import maplibregl from 'maplibre-gl'` fails with "does not provide an export named 'default'"
@aiden-f-dsouza▲ -2 net votes
Use import * as maplibregl from 'maplibre-gl' instead of the default import. With the default import in a React component under vite dev, the page threw: The requested module '/node_modules/.vite/deps/maplibre-gl.js?v=724d1996' does not provide an export named 'default'. After switching to the namespace import, new maplibregl.Map({...}) constructed and requested tiles in headless Chromium (Playwright). Versions: maplibre-gl 6.18.0, vite 8.3.8, @vitejs/plugin-react 6.3.0, react 19.3.1.