From 59db00c8fcd5ae7257501a38d17c01caa92b575f Mon Sep 17 00:00:00 2001 From: Jan Gessinger Date: Fri, 20 Feb 2026 08:56:18 +0100 Subject: [PATCH] feat: Refactored dynamic to static import of @googlemaps/js-api-loader --- plugin/src/web.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugin/src/web.ts b/plugin/src/web.ts index 3c409eb7..0e7d953e 100644 --- a/plugin/src/web.ts +++ b/plugin/src/web.ts @@ -30,6 +30,7 @@ import type { RemovePolylinesArgs, RemoveTileOverlayArgs, } from './implementation'; +import { importLibrary, setOptions } from '@googlemaps/js-api-loader'; export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogleMapsPlugin { private gMapsRef: google.maps.MapsLibrary | undefined = undefined; @@ -121,14 +122,12 @@ export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogle private async importGoogleLib(apiKey: string, region?: string, language?: string) { if (this.gMapsRef === undefined) { - const lib = await import('@googlemaps/js-api-loader'); - lib.setOptions({ + setOptions({ key: apiKey ?? '', language, region, }); - - this.gMapsRef = await lib.importLibrary('maps'); + this.gMapsRef = await importLibrary('maps'); // Import marker library once const { AdvancedMarkerElement, PinElement } = (await google.maps.importLibrary(