-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate deps.inline
in favour of deps.optimizer
#3521
Comments
server
option to pass down options for Vite Node instead of deps.inline
/deps.exclude
#3522
One use case where Will |
|
Will |
The idea is to make it easier to work with. We are currently gathering feedback and it looks like this option will stay in one form or another. Ideally, we would like these packages to just work out of the box. |
Might be hijacking thread, but is there a plan for vite-node to allow reading values from config file? test: {
deps: {
external: [/some-package/],
},
} If I do (got here because I also have similar issue with package that exposes many entry points) |
Clear and concise description of the problem
Currently, it is not very obvious to most users how
deps.inline
works and why it needs to be used for certain packages. It also doesn't work with monorepo packages whenstring
version is used (internally it just checksnode_modules/{name}
).This option also makes tests run slower because Vitest needs to process these files through Vite pipeline one by one which is not very optimal. This is also not what Vite itself is doing when it's running in the browser.
On the other hand,
deps.optimizer
does the same thing that Vite does with the package in the browser - it pre-bundles it into a single entry point. This makes it faster to import, fixes CJS compatibility issues, and allows the use of plugins and aliases on a just single compiled file.Vitest provides this option for quite some time, but we hit the wall with how the optimizer works in the browser. When it hits the new module, Vite just reloads the page and starts optimizing again - we can't do this so easily in our case. We also don't want to bundle actual Node.js packages that are used in setup files, for example. To solve this issue, Vite team introduced
noDiscovery
option in Vite 4.3. Theoretically, this should solve our issues and be an alternative todeps.inline
.Suggested solution
To make the transition clear, we should deprecate
deps.inline
,deps.exclude
, anddeps.registerNodeLoader
with a message:Use "deps.optimizer" instead.
. Instead of removing these options completely, we should provide them in a new option calledserver
for those who prefer using Vite Node to run their source code instead of native Node (the name of the option is debatable - we can't name itviteNode
, because the project will have a different name by the time it is implemented in Vite core).Validations
The text was updated successfully, but these errors were encountered: