Vite · VITE0006

Type custom Vite define globals

Flags untyped define in Vite define code before it leaks into runtime behavior.
VITE0006vite-doctor/vitetypeswarnNo fix

Run this rule

pnpm vite-doctor . --framework vite --extends auto,vite/strict --rules vite/define/no-untyped-define

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 untyped define, or move it to the Vite runtime/API that owns that behavior.

Example

Declare define constants

Before

export default defineConfig({
  define: {
    __FEATURE_FLAG__: JSON.stringify(true),
  },
})

After

declare const __FEATURE_FLAG__: boolean

export default defineConfig({
  define: {
    __FEATURE_FLAG__: JSON.stringify(true),
  },
})
Copyright © 2026