Import from defining modules instead of barrel files
Run this rule
pnpm vite-doctor . --extends auto,vite/strict --rules vite/imports/no-barrel-files
Why it matters
A barrel file only re-exports other modules. When code imports one binding from it, Vite cannot tell which re-exported module provides that binding or whether any of them has initialization side effects, so in dev it fetches and transforms every module the barrel re-exports. The page loads more files than it needs. Doctor reports the import site only when every imported binding traces to a defining module and some re-exported modules are unused. It ignores type-only imports, namespace imports, module IDs with query or hash suffixes, modules with side-effect or unre-exported value imports, barrels with fewer than three re-exported modules, package entry points declared by package.json exports (including subpath patterns), main, or module, and files under node_modules or generated directories.
Recommended fix
Import each binding from the module that defines it. The diagnostic lists the direct imports to use. Keep the barrel if it is a public package entry point or other code still needs it.
Useful links
Example
Import from the defining module
Before
// src/utils/index.ts
export * from './date'
export * from './currency'
export * from './charts'
// src/pages/Home.vue
import { formatDate } from '@/utils'
After
// src/pages/Home.vue
import { formatDate } from '@/utils/date'