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
Building ?worker
works in dev but bundling with Terser errors
#9566
Labels
Comments
This comment was marked as duplicate.
This comment was marked as duplicate.
I had a similar issue when using the following import syntax for web workers. import MyWorker from './path/to/my-worker?worker'
const worker = new MyWorker() This caused the build to fail in GitHub Actions with a similar error message as the one described by @modderme123. We worked around the issue by using the import MyWorkerUrl from './path/to/my-worker?url'
const worker = new Worker(MyWorkerUrl, { type: 'module' }) |
4 tasks
sapphi-red
added
p3-minor-bug
An edge case that only affects very specific usage (priority)
feat: web workers
and removed
pending triage
labels
Dec 7, 2022
Closing as I confirmed this is fixed from 4.0.0-beta.1. I guess #11218 fixed this. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Describe the bug
When using Terser and Workers on non-trivial dependencies, vite seems to exhibit a concurrency bug which causes terser to error and forces the bundle to stop. However, this bug is particularly confusing for developers because it doesn't mention terser at all! Instead, it says
Ideally whatever error terser is causing should be correctly logged (and terser shouldn't error on this worker bundle).
I've tried to figure out what error is stopping the build but it seems like importing terser just immediately halts the worker with no errors logged
I also tested this bug on stackblitz and it seems that it is missing the on("beforeExit") nodejs feature so doesn't log anything and instead silently outputs nothing: https://stackblitz.com/edit/vite-workers-bug
Reproduction
https://github.com/modderme123/vitebug/
System Info
System: OS: macOS 12.5 CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz Memory: 17.69 MB / 16.00 GB Shell: 3.5.1 - /usr/local/bin/fish Binaries: Node: 18.7.0 - /usr/local/bin/node npm: 8.16.0 - /usr/local/bin/npm Browsers: Chrome: 103.0.5060.134 Safari: 15.6 npmPackages: vite: ^3.0.4 => 3.0.4
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: