Vite · VITE0014
Filter broad Vite plugin transforms
Finds Vite plugin code that should use the supported transform filter pattern instead.
Run this rule
pnpm vite-doctor . --framework vite --extends auto,vite/strict --rules vite/plugin/prefer-transform-filter
Why it matters
A hook filter lets Vite and Rolldown skip invoking transform() for unrelated modules instead of paying for a userland check on every file.
Recommended fix
Use the Vite-supported transform filter pattern instead.
Useful links
Example
Filter plugin transforms
Before
export default function markdownPlugin() {
return {
name: 'markdown',
transform(code, id) {
if (!id.endsWith('.md')) return
return code
},
}
}
After
export default function markdownPlugin() {
return {
name: 'markdown',
transform: {
filter: { id: /\.md$/ },
handler(code) { return code },
},
}
}