GdzieWjade/scripts/copy-worker.mjs
2026-10-03 13:33:50 +02:00

7 lines
439 B
JavaScript

// MapLibre 6 runs as an ES-module worker that imports a shared chunk next to it; copy both
// to public/ so they are served with stable names and precached by the service worker.
import { copyFile, mkdir } from 'node:fs/promises';
await mkdir('public/maplibre', { recursive: true });
for (const f of ['maplibre-gl-worker.mjs', 'maplibre-gl-shared.mjs']) {
await copyFile(`node_modules/maplibre-gl/dist/${f}`, `public/maplibre/${f}`);
}