Vite · VITE0021
Use Vite's static worker URL pattern
Checks that Vite worker code includes the worker URL pattern needed for predictable behavior.
Run this rule
pnpm vite-doctor . --framework vite --rules vite/worker/require-worker-url-pattern
Why it matters
Vite configuration runs in both dev and build pipelines. Narrow, explicit settings reduce surprises across SSR, workers, and local file access.
Recommended fix
Add worker URL pattern where Vite expects it, close to the code that depends on it.
Useful links
Example
Use Vite worker URL pattern
Before
const worker = new Worker('./worker.ts')
After
const worker = new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' })