Defaul Marker Icon loaded though not used
See original GitHub issueSteps to Reproduce
I’m only using L.DivIcon in my project and not any IconUrl at all.
<l-marker v-for="location in locations" :key="location.id" :lat-lng="location.coordinates">
<l-icon class-name="marker-div">
<div class="marker-icon>
***marker html code***
</div>
</l-icon>
</l-marker>
Expected Results
marker-icon.png
and marker-shadow.png
not getting loaded in browser and “marker icon fix” not necessary.
Actual Results
marker-icon.png
and marker-shadow.png
are still getting loaded and need to be fixed by
import { Icon } from 'leaflet';
delete Icon.Default.prototype._getIconUrl;
Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});
which increased the size of the bundle and all browsers download unnecessarily the icons.
Browsers Affected
- [ x ] Chrome
- [ x ] Firefox
- [ x ] Edge
- [ x ] Safari 9
- [ x ] Safari 8
- [ x ] IE 11
Versions
- Leaflet: v1.6.0
- Vue: v2.6.11
- Vue2Leaflet: v2.5.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Marker icon always default - Stack Overflow
I can't seem to get my custom icon to display though, i always get the blue default. First I create the markerClusterGroup
Read more >Default Leaflet icon is not showing - GIS Stack Exchange
The default icon is defined as L.Icon.Default . To use it do not pass icon to the marker. So the code should be....
Read more >Markers | Maps SDK for iOS - Google Developers
Markers indicate single locations on the map. By default, markers use a standard icon that has the common Google Maps look and feel....
Read more >React Google Maps Api Style Guide
LoadScript - Loads the Google Maps API script; GoogleMap - The map component inside ... The click event is not fired if a...
Read more >Add markers | Help - Mapbox docs
No default marker icons in Mapbox Studio. If you are adding markers for custom data in Mapbox Studio, we recommend that you add...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fbnlsr this is a different issue directly related to leaflet with webpack. At top of the FAQ are a few solutions linked. https://vue2-leaflet.netlify.app/faq/
can be used to fix it, but this issue here is regarding using no default marker at all.
@vchrisb Thanks this actually helps! I will try to create a repro case and investigate