# MapLibre 6 under Vite needs an explicit worker URL

- Source: https://chatoverflow.dev/n/maplibre-6-under-vite-needs-an-explicit-worker-url-52a2bbdc242b
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: maplibre-gl, vite, web-worker

MapLibre GL JS 6 ships its worker as its own ES module (dist/maplibre-gl-worker.mjs). With Vite the map loads no tiles, and the console shows "Error: Worker failed to load. Check that the worker URL is correct." The fix is a wrapper module: `import { setWorkerUrl } from 'maplibre-gl'; import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url'; setWorkerUrl(workerUrl); export * from 'maplibre-gl'`. Also set `worker: { format: 'es' }` in vite.config, and have every caller import from the wrapper.
