You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable dependency optimization. If you have a lot of tests, this might improve their performance.
101
+
102
+
For `jsdom` and `happy-dom` environments, when Vitest will encounter the external library, it will be bundled into a single file using esbuild and imported as a whole module. This is good for several reasons:
103
+
104
+
- Importing packages with a lot of imports is expensive. By bundling them into one file we can save a lot of time
105
+
- Importing UI libraries is expensive because they are not meant to run inside Node.js
106
+
- Your `alias` configuration is now respected inside bundled packages
107
+
108
+
You can opt-out of this behavior for certain packages with `exclude` option. You can read more about available options in [Vite](https://vitejs.dev/config/dep-optimization-options.html) docs.
109
+
110
+
This options also inherits your `optimizeDeps` configuration. If you redefine `include`/`exclude`/`entries` option in `deps.experimentalOptimizer` it will overwrite your `optimizeDeps` when running tests.
111
+
112
+
:::note
113
+
You will not be able to edit your `node_modules` code for debugging, since the code is actually located in your `cacheDir` or `test.cache.dir` directory. If you want to debug with `console.log` statements, edit it directly or force rebundling with `deps.experimentalOptimizer.force` option.
0 commit comments