Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: Issues with map initialisation

Blue Mouse860bd10c701e
diff --git a/web/app/routes/tools.ip-lookup.tsx b/web/app/routes/tools.ip-lookup.tsx
index 41851d528..67c7a0056 100644
--- a/web/app/routes/tools.ip-lookup.tsx
+++ b/web/app/routes/tools.ip-lookup.tsx
@@ -6,6 +6,7 @@ import {
MagnifyingGlassIcon,
} from '@phosphor-icons/react'
import leafletStyles from 'leaflet/dist/leaflet.css?url'
+import mapLibreWorkerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url'
import mapLibreStyles from 'maplibre-gl/dist/maplibre-gl.css?url'
import { useState, useEffect, useMemo, useRef } from 'react'
import type { LinksFunction, MetaFunction } from 'react-router'
@@ -183,7 +184,9 @@ function LocationMap({ latitude, longitude }: LocationMapProps) {
import('react-leaflet'),
import('leaflet'),
import('@maplibre/maplibre-gl-leaflet'),
- ]).then(([rl, L, gl]) => {
+ import('maplibre-gl'),
+ ]).then(([rl, L, gl, maplibre]) => {
+ maplibre.setWorkerUrl(mapLibreWorkerUrl)
if (!cancelled) setModules({ rl, L, gl })
})