Skip to content

Commit 908e4d0

Browse files
Copilotharlan-zw
andauthored
fix: Convert MarkerClusterer to dynamic import to support optional peer dependency (#551)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: harlan-zw <5326365+harlan-zw@users.noreply.github.com>
1 parent 43e3670 commit 908e4d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</template>
44

55
<script lang="ts">
6-
import { MarkerClusterer, type MarkerClustererOptions } from '@googlemaps/markerclusterer'
6+
import type { MarkerClusterer, MarkerClustererOptions } from '@googlemaps/markerclusterer'
77
import { inject, onUnmounted, provide, shallowRef, type InjectionKey, type ShallowRef } from 'vue'
88
import { whenever } from '@vueuse/core'
99
import { MAP_INJECTION_KEY } from './ScriptGoogleMaps.vue'
@@ -33,7 +33,8 @@ const mapContext = inject(MAP_INJECTION_KEY, undefined)
3333
3434
const markerClusterer = shallowRef<MarkerClusterer | undefined>(undefined)
3535
36-
whenever(() => mapContext?.map.value, (map) => {
36+
whenever(() => mapContext?.map.value, async (map) => {
37+
const { MarkerClusterer } = await import('@googlemaps/markerclusterer')
3738
markerClusterer.value = new MarkerClusterer({
3839
map,
3940
...props.options,

0 commit comments

Comments
 (0)