Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 23 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# debug
# dependencies
# env files (can opt-in for committing if needed)
# misc
# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
# testing
# typescript
# vercel
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
*.tsbuildinfo
.DS_Store
.env*

# vercel
.pnp.*
.pnpm-debug.log*
.vercel

# typescript
*.tsbuildinfo
.yarn/*
/.next/
/.pnp
/build
/coverage
/node_modules
/out/
next-env.d.ts
npm-debug.log*
public/maplibre-gl-worker.mjs
yarn-debug.log*
yarn-error.log*
2 changes: 1 addition & 1 deletion components/MapScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import DetailPanel, { type Detail } from "@/components/DetailPanel";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
import { loadCdnData, type CdnData } from "@/lib/cdn";
import { createMap, onStyleLoad } from "@/lib/map/createMap";
Expand Down
11 changes: 10 additions & 1 deletion lib/map/createMap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { BELARUS_BOUNDS, LIBERTY_STYLE } from "./style";

// v6 ships ESM-only and spawns its worker from a URL. Turbopack resolves that
// URL to a virtual /_next/static/media/maplibre-gl-worker.mjs?v=… that never
// exists on disk (the real file is content-hashed), so the worker 404s and
// the map hangs silently before its first render — no tiles, no markers, no
// error events. The prebuild script copies the worker into public/ and we
// point maplibre at it explicitly; the copy happens per build, so worker and
// main module can never drift apart.
maplibregl.setWorkerUrl("/maplibre-gl-worker.mjs");

// The single MapLibre bootstrap — the same role as the dashboard's
// ui/map/createMap.js: vector style, bounds, the bottom-right controls. The
// attribution control is off (the user's call, 2026-11-14, like the
Expand Down
2 changes: 1 addition & 1 deletion lib/map/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// sized 18x20, the maplibregl root anchors bottom so the sign's tip sits on
// the point; the skins live in the sibling map.css.

import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import "./map.css";
import type {
CdnPoint,
Expand Down
2 changes: 1 addition & 1 deletion lib/map/overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// DOM sign markers (see markers.ts).

import type { Feature, FeatureCollection, LineString } from "geojson";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import type { CdnData, CdnPoint, MediumSpeedCamera, RoadRepair } from "../cdn";
import type { SelectFeature } from "./markers";
import { MEDIUM_SPEED_LINE_COLOR, REPAIRS_LINE_COLOR } from "./style";
Expand Down
104 changes: 47 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"version": "0.1.0",
"private": true,
"scripts": {
"predev": "node scripts/copy-maplibre-worker.mjs",
"prebuild": "node scripts/copy-maplibre-worker.mjs",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"maplibre-gl": "^5.24.1",
"maplibre-gl": "^6.18.0",
"next": "16.4.6",
"react": "19.3.0",
"react-dom": "19.3.0"
Expand Down
15 changes: 15 additions & 0 deletions scripts/copy-maplibre-worker.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// maplibre-gl v6 spawns its worker from a URL that turbopack resolves to a
// virtual /_next/static/media/maplibre-gl-worker.mjs?v=… — a URL that never
// exists on disk (the emitted file is content-hashed). The worker 404s and
// the map hangs silently before its first render. This script copies the
// installed version's worker into public/ so createMap.ts can point
// setWorkerUrl at a real, version-matched file.
import { copyFileSync, mkdirSync } from "node:fs";
import { createRequire } from "node:module";

const require = createRequire(import.meta.url);
const workerPath = require.resolve("maplibre-gl/dist/maplibre-gl-worker.mjs");

mkdirSync("public", { recursive: true });
copyFileSync(workerPath, "public/maplibre-gl-worker.mjs");
console.log(`copied ${workerPath} -> public/maplibre-gl-worker.mjs`);
Loading