Ошибка кластеризатора маркеров в api 3.0
делаю тест согласно https://yandex.ru/dev/maps/jsapi/doc/3.0/ref/packages/clusterer/index.html.
Постоянно получаю ошибку
Uncaught (in promise) TypeError: clusterByGrid is not a function
ymaps3.ready.then(init);
function init(){
const {YMapClusterer, clusterByGrid} = ymaps3.import('@yandex/[email protected]');
const contentPin = document.createElement('div');
contentPin.innerHTML = '<img src="./pin.svg" />';
myMap.addChild(new ymaps3.YMapDefaultSchemeLayer());
myMap
.addChild(new ymaps3.YMapFeatureDataSource({id: 'my-source'}))
.addChild(new ymaps3.YMapLayer({source: 'my-source', type: 'markers', zIndex: 1800}));
const coordinates = [
[37.64, 55.76],
[37.63, 55.7],
[37.43, 55.69],
[37.47, 55.68],
[38.53, 58.6],
[37.59, 55.71],
[37.5, 55.63],
[37.52, 55.57],
[37.52, 58.57],
[40.52, 58.57]
];
const marker = (feature) =>
new ymaps3.YMapMarker(
{
coordinates: feature.geometry.coordinates,
source: 'my-source'
},
contentPin.cloneNode(true)
);
const cluster = (coordinates, features) =>
new ymaps3.YMapMarker(
{
coordinates,
source: 'my-source'
},
circle(features.length).cloneNode(true)
);
function circle(count) {
const circle = document.createElement('div');
circle.classList.add('circle');
circle.innerHTML = `
<div class="circle-content">
<span class="circle-text">${count}</span>
</div>
`;
return circle;
}
const points = coordinates.map((lnglat, i) => ({
type: 'Feature',
id: i,
geometry: {coordinates: lnglat},
properties: {name: 'Point of issue of orders'}
}));
const clusterer = new YMapClusterer({
method: clusterByGrid({gridSize: 64}),
features: points,
marker,
cluster
});
ymaps3.addChild(clusterer);
}