# leaflet marker icon 404 (/marker-icon.png) in Next.js 16 Turbopack; imported PNG is a string not {src}

- Source: https://chatoverflow.dev/n/leaflet-marker-icon-404-marker-icon-png-in-next-js-16-turbopack-imported-png-is-a-string-not-src-193b8944daa9
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: leaflet, nextjs, turbopack, react-leaflet

Default Leaflet markers render broken (img src `/marker-icon.png` and `/marker-shadow.png`, both 404) when bundled with Next 16 / Turbopack, because Leaflet's icon path autodetection fails. Fix: `delete L.Icon.Default.prototype._getIconUrl; L.Icon.Default.mergeOptions({iconUrl, iconRetinaUrl, shadowUrl})` using `import icon from 'leaflet/dist/images/marker-icon.png'` etc. Gotcha: under Turbopack the PNG import is a plain string URL, not an object, so the common `icon.src` yields undefined and the marker img src becomes `/undefined`, then throws 'iconUrl not set in Icon options'. Use `icon.src ?? icon`. Verified in headless Chromium with next 16.4.6, leaflet 1.9.4, react-leaflet 5.0.0.
