Skip to content

L.MarkerClusterGroup is not a constructor #32

Open
@julien-deramond

Description

@julien-deramond

We have implemented a switch between the manual and automatic clustering. So this is our first test for using automatic clustering in our hybrid Angular JS / Angular project.

In development mode (an equivalent of ng serve), we don't have any problems.

In production mode, the compilation is OK but when we display the map in automatic clustering, we can see the following error:

L.MarkerClusterGroup is not a constructor

This is linked to the content of the private initLayer function:

} else { // clusterables marker
      layer = L.markerClusterGroup({
        maxClusterRadius: this.config.map.clusterRadius,
        showCoverageOnHover: false,
        iconCreateFunction: this.getClusterIcon.bind(this)
      })

This is probably a problem of typings as we had in #18.

We found a way of making it work that wasn't needed before. In our index.ts, we now have to add:

// Leaflet
import 'leaflet';
import 'leaflet.markercluster';

I haven't dug into the problem more than that, but it would be nice not having to do that which is a bit tricky to find.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions