import { chmodSync, copyFileSync, mkdirSync, statSync } from 'node:fs'; import { dirname, resolve } from 'node:path'; const source = resolve('node_modules/maplibre-gl/dist/maplibre-gl-worker.mjs'); const target = resolve('dist/assets/maplibre-gl-worker.mjs'); mkdirSync(dirname(target), { recursive: true }); copyFileSync(source, target); chmodSync(target, 0o644); const bytes = statSync(target).size; if (bytes < 1000) throw new Error(`MapLibre worker inválido: ${bytes} bytes`); console.log(`MapLibre worker: ${target} (${bytes} bytes)`);