-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Worker and build only error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve #13367
Comments
Start a new pull request in StackBlitz Codeflow. |
Any known workaround to this in the meantime? |
I had the same error message on my project : yarn vite build --mode dev
yarn run v1.22.19
$ vite build --mode dev
vite v4.3.9 building for dev...
transforming (419)
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:worker-import-meta-url) transform "/Users/project/src/utils/worker-connector.ts"
error during build:
Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:worker-import-meta-url) transform "/Users/project/src/utils/worker-connector.ts"
at process.handleBeforeExit (file:///Users/project/node_modules/rollup/dist/es/shared/node-entry.js:25014:28)
at Object.onceWrapper (node:events:628:26)
at process.emit (node:events:513:28)
error Command failed with exit code 1. My issue was a bit different than your but I wanted to share it in case someone is facing the same problem as it took me some time to fixed it. So I got this because I was importing some functions from my utils folder, and in my utils folder I have a export { encryptText, decryptText } from "./crypto-web" And I was importing it in my import { decryptText, encryptText } from "@/utils" This was working fine in dev, but got the error in build. To fix it I had to change the import to reference the full file and make sure there is no interdependence (or same import style) inside the file I'm importing (only for import and files related to the worker), like this : import { decryptText, encryptText } from "../utils/crypto-web" Fixed my build. Hope this will help someone. |
Hey, I've encountered the same issue, although I'm not spawning workers inside workers. I'm using one worker which imports the @jsquash/avif library and encodes an image. It works fine in dev mode but when trying to build with vite I get the same error as the people above. Is a fix in the working? |
This also happens when a worker imports wasm_bindgen code that uses wasm_bindgen_rayon. |
Is this vite or rollup? It also happens when importing UPDATE: this went away when I moved the (buggy) code that was creating a worker and being included in the code built for the background worker (using vite-plugin-pwa). |
Not spawning worker in worker but same error. Dev mode works fine but build fails. |
Can also confirm this errors for wasm_bindgen_rayon, as it starts its own set of (nested) Workers. I know nested Workers sounds somewhat niche, and it is marked as a minor bug, but it is a valid use case and Vite erroring for it simply limits me in the stuff I can build. Hope this gets addressed soon. |
Yeah my issue is with |
Linking a few resources to help give this issue context. This is breaking due to the serialisation of Worker rollup builds. There's an unresolvable promise because two rollup builds rely on each other to resolve.
|
When we have multiple workers, the config cannot be used as web map key since the config can mutate. Since we're not in a multi-thread environment we can use a fixed key to store the promise of the current worker build. You can use the reproduction provided in vitejs#13367 , when building the third worker, there is a pending promise since the config changes and there is no way to delete it and then the error.
Just wondering what the current steps are to fix or patch around this issue? The error message doesn't offer any help as to where things are fouling up for me. I even tried commenting everything out in my entry point files to no avail. |
For me, downgrading to Vite 4.2.x got me back on the road again. I'd still love to hear about how one would go about figuring out the particular culprit in these scenarios. It seems related to plugins? |
Lol, is this fixed? |
Hey @Vanilagy, #14685 has been released in [email protected]. Did it work for your use case? |
Describe the bug
I have issues with build when I have worker inside worker when using sqllite when I have workers in workers
Works fine in dev, but not in build
Though it first was a sqllite/wasm issue and something I was missing. but found out their stackblitz worked fine even on build
So stripped it down to just vite as dependency
Asked here before I created the issue, just incase I was doing something wrong
#13357
@sapphi-red FYI
Reproduction
https://stackblitz.com/edit/vitejs-vite-zafzfp
Steps to reproduce
download and try and run npm run build
It runs fine in dev mode (see image 1), but if you download it and try and run npm run build you get (see image2)
Image 1
Image 2
System Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: