Vite 3 - npm package as rollupOptions.input
fails when package is unused by other inputs
#8750
Closed
7 tasks done
Labels
feat: deps optimizer
Esbuild Dependencies Optimization
p3-downstream-blocker
Blocking the downstream ecosystem to work properly (priority)
Describe the bug
I am running a Vite 3 production build via the JavaScript API, and I'm using an npm package within my
build.rollupOptions.input
array. This succeeds for npm packages used by other files in theinput
array. However, if that npm package is unused by other inputs, the build will fail!Example:
Interestingly, I was unable to replicate in Stackblitz. See the link below for a step-by-step reproduction when running locally!
Reproduction
https://github.com/bholmesdev/vite-3-bug-build-npm-package
System Info
Used Package Manager
npm
Logs
vite v3.0.0-beta.1 building for production...
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:optimized-deps-build) load "/Users/benholmes/Sandbox/vite-server-build-simulaneously/node_modules/.vite/deps_build-dist/is-odd.js"
file:///Users/benholmes/Sandbox/vite-server-build-simulaneously/node_modules/rollup/dist/es/shared/rollup.js:23048
reject(new Error(
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:\n
+^
Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:optimized-deps-build) load "/Users/benholmes/Sandbox/vite-server-build-simulaneously/node_modules/.vite/deps_build-dist/is-odd.js"
at EventEmitter.handleEmptyEventLoop (file:///Users/benholmes/Sandbox/vite-server-build-simulaneously/node_modules/rollup/dist/es/shared/rollup.js:23048:20)
at Object.onceWrapper (node:events:639:28)
at EventEmitter.emit (node:events:520:28)
at process. (file:///Users/benholmes/Sandbox/vite-server-build-simulaneously/node_modules/rollup/dist/es/shared/rollup.js:23042:55)
at process.emit (node:events:520:28)
Validations
The text was updated successfully, but these errors were encountered: