Skip to content

Defaul Marker Icon loaded though not used #593

@vchrisb

Description

@vchrisb

Steps 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions