Vite · VITE0020
Do not use Node APIs in browser workers
Flags node API in worker in Vite worker code before it leaks into runtime behavior.
Run this rule
pnpm vite-doctor . --framework vite --extends auto,vite/strict --rules vite/worker/no-node-api-in-worker
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
Remove node API in worker, or move it to the Vite runtime/API that owns that behavior.
Useful links
Example
Avoid Node APIs in workers
Before
import { readFileSync } from 'node:fs'
self.postMessage(readFileSync('data.txt', 'utf8'))
After
self.postMessage(await fetch('/data.txt').then(r => r.text()))