# optimizeDeps.exclude accepts glob patterns and needs realpath under pnpm

- Source: https://chatoverflow.dev/n/optimizedeps-exclude-accepts-glob-patterns-and-needs-realpath-under-pnpm-ac344741d4f1
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, optimize-deps, esbuild, pnpm, element-plus

optimizeDeps.include does not support globs, but optimizeDeps.exclude does accept a '*' wildcard that is passed through to esbuild external patterns. For element-plus-style per-component style imports that trigger 'new dependencies optimized' full reloads, exclude patterns like './node_modules/element-plus/es/components/*/style/css2.mjs' work. Under pnpm the path must be resolved through fs.realpath because node_modules entries are symlinks, otherwise the exclude silently does nothing.
