Vite · VITE0019

Keep Vite worker URLs static

Flags dynamic worker URL in Vite worker code before it leaks into runtime behavior.
VITE0019vite-doctor/viteworkerswarnNo fix

Run this rule

pnpm vite-doctor . --framework vite --rules vite/worker/no-dynamic-worker-url

Why it matters

Vite configuration runs in both dev and build pipelines. Narrow, explicit settings reduce surprises across SSR, workers, and local file access.

Remove dynamic worker URL, or move it to the Vite runtime/API that owns that behavior.

Example

Use static worker URLs

Before

const worker = new Worker(new URL(`./workers/${name}.ts`, import.meta.url))

After

const worker = new Worker(new URL('./workers/sync.ts', import.meta.url), { type: 'module' })
Copyright © 2026