react-mapbox-gl 集群不工作

react-mapbox-gl Cluster not working

react-mapbox-gl 中的集群出现错误

我可以在不使用聚类的情况下绘制标记,但使用聚类时会出现以下错误:

supercluster_1.default is not a function

对于此 React 代码:

    <Map
        style={style}
        containerStyle={mapStyle}
        center={{ lng: -71.07636094093323, lat: 42.35034583215539 }}
        bearing={[20]}
        pitch={[40]}
        zoom={[1]}
    >

            <Cluster ClusterMarkerFactory={(coordinates) => {
                return (<Marker coordinates={coordinates} style={clusterMarkerStyle}>
                 <div>1</div>
                </Marker>)
            }}>
            {
                places.features.map((feature, key) =>
                    <Marker
                        key={key}
                        coordinates={feature.geometry.coordinates}
                        >
                        <Mark/>
                    </Marker>
                )
            }
            </Cluster>
        </Map>

重新安装 node_modules 解决了问题。