Closed mike-lloyd03 closed 1 year ago
Please use svelte discord or stack overflow for support questions. Leaflet is using some runtime detection for loading the default marker and it doesn't work well with bundler. You can set the iconUrl
in the icon option to a CDN url, Or you can import the icon and pass it to the iconUrl
option
import markerIcon from 'leaflet/dist/images/marker-icon.png';
I tried asking in the Discord first but got no response. Thanks for pointing me in the right direction.
Describe the bug
I'm writing an app that uses LeafletJS to render a map on the page. In dev, this map loads correctly with a pin on the user's location (the icon for the pin is being loaded from
node_modules
). But when I deploy using the node adapter (in a docker container) the image for the pin fails to load with a 404 error. It attempts to load the image from https://unpkg.com/leaflet@1.9.3/distmarker-icon.png but it should be getting it from https://unpkg.com/browse/leaflet@1.9.3/dist/images/marker-icon.png. How can I get it to load from the right URL or alternatively, how can I get it to load from the filesystem?I'm using SvelteKit 1.0, node-adapter 1.0.0, and vite 4.0.0.
Reproduction
Logs
No response
System Info
Severity
annoyance
Additional Information
No response