Currently
optimizeDeps.include
is a list of entries to pre-add to the optimized listoptimizeDeps.exclude
is a list of package names or entry names that will be excluded (works by checking both the id and the pkgId for each value)
#12414 proposes to add support for globs in optimizeDeps.include
Sheremet is looking to replace inline
by optimizeDeps.include
in Vitest.
- a new option
optimizeDeps.byDefault: false
that would make include/exclude work like a regular createFilter over found dependenciesoptimizeDeps.include
supports globsoptimizeDeps.exclude
supports globs
I don't think we should do this, as it is confusing that the semantics of include from "pre-add these deps" to "work as createFilter include".
Keep include/exclude as is, but only dependencies listed in optimizeDeps.include
(and not excluded) would be optimized.
This option will also turn off the scanner (same effect as optimizeDeps.entries: []
).
Same effect as 2., but having optimizeDeps.ignoreMissing: true
to ignore dependencies when found while resolving. The user will need to turn off the scanner with entries: []
too.
I prefer 2. because the scanner is conceptually an optimization, the option should affect both deps found by resolving or by the scanner to me.
optimizeDeps.filter
that could be a(id: string) => boolean
(by default is() => true
). We could also have{ include, exclude }
but it may be confusing with the other options. So Vitest could use filter to only optimize certain deps.