dynamically import the maptiler api key

This commit is contained in:
2026-08-31 14:38:02 +00:00
parent 07f6a77fc6
commit 20dddaa263
2 changed files with 4 additions and 4 deletions

View File

@@ -55,9 +55,9 @@
onMount(async () => { onMount(async () => {
const { Map, Marker, config } = await import('@maptiler/sdk'); const { Map, Marker, config } = await import('@maptiler/sdk');
const { PUBLIC_MAPTILER_API_KEY } = await import('$env/static/public'); const { env } = await import('$env/dynamic/public');
config.apiKey = PUBLIC_MAPTILER_API_KEY; config.apiKey = env.PUBLIC_MAPTILER_API_KEY;
MapMarker = Marker; MapMarker = Marker;
const initMap = (center: [number, number], zoom: number) => { const initMap = (center: [number, number], zoom: number) => {

View File

@@ -68,8 +68,8 @@
async function initMap() { async function initMap() {
if (!mapContainer || lat === null || lng === null) return; if (!mapContainer || lat === null || lng === null) return;
const { Map, Marker, config } = await import('@maptiler/sdk'); const { Map, Marker, config } = await import('@maptiler/sdk');
const { PUBLIC_MAPTILER_API_KEY } = await import('$env/static/public'); const { env } = await import('$env/dynamic/public');
config.apiKey = PUBLIC_MAPTILER_API_KEY; config.apiKey = env.PUBLIC_MAPTILER_API_KEY;
map = new Map({ map = new Map({
container: mapContainer, container: mapContainer,