Running vite dev
doesn't exit with an error when there is a problem in the dependency optimisation step (esbuild)
#19364
Labels
Describe the bug
Currently in the Ember project we are using the command
vite optimize
to verify that all the dependencies are being optimised correctly (see this test file if you're curious). With the recent deprecation of thevite optimize
command #19348 we need a way to be able to verify the dependency optimisation step passes without error in our CI.We can't rely on
vite dev
for this information because an esbuild plugin fails for any reason that dependency just gets externalised and will be re-loaded once the Vite dev server starts. You can see that behaviour in the linked reproduction.Even if we don't make vite dev always fail for people if esbuild fails (maybe this is a default that might need to wait for a major?) we would love the ability to pass an arg that would opt-in to this behaviour e.g.
vite dev --brittle
or somethingReproduction
https://stackblitz.com/edit/vitejs-vite-tb94xq8d?file=vite.config.js
Steps to reproduce
System Info
This is just taken from the stackblitz link above: System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vite: ^6.0.0 => 6.0.11
Used Package Manager
npm
Logs
VITE v6.0.11 ready in 1069 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
Error: Failed to scan for dependencies from entries:
/home/projects/vitejs-vite-tb94xq8d/index.html
✘ [ERROR] oops [plugin example]
This error came from the "onResolve" callback registered here:
The plugin "example" was triggered by this import
Validations
The text was updated successfully, but these errors were encountered: