Skip to content

fix(worker): align worker urls in client and server when using terser - #23614

Open
BPScott wants to merge 1 commit into
vitejs:mainfrom
BPScott:fix-worker-urls-with-terser
Open

BPScott wants to merge 1 commit into
vitejs:mainfrom
BPScott:fix-worker-urls-with-terser

Conversation

@BPScott

@BPScott BPScott commented Sep 30, 2026 •

Copy link
Copy Markdown

Worker urls generated in the server build must match the filenames created in the client build. This worked with the default minifier, but did not work when explicitly using terser as the minifier for client builds. This was because the terser plugin did not read its minification options from the per-environment config.

This PR updates the terser plugin to read from the per-environment config rather than the top-level config.

Review with whitespace disabled - most of the change is reformatting of the test case.


See #21871 for prior art that fixed a regression in this behaviour when using the default minifier.

I found this bug in v7.3.5, but I'm not expecting a backport. (for now I'm applying this change as a patch-package while I work through the Vite 8 update).

AI Disclosure: I used Claude to identify this problem, and author the fix and test case. Code has been reviewed by me, and the commit message / PR description is human authored.

@BPScott BPScott changed the title fix(worker): Align worker urls in client and server when using terser fix(worker): align worker urls in client and server when using terser Sep 30, 2026
@BPScott
BPScott force-pushed the fix-worker-urls-with-terser branch 2 times, most recently from 4c4ccf3 to e8e8743 Compare October 1, 2026 01:37
Worker urls generated in the server build must match the filenames
created in the client build. This worked with the default minifier, but
did not work when explictly using terser as the minifier for client
builds. This was because the terser plugin did not read its minification
options from the per-environment config.
@BPScott
BPScott force-pushed the fix-worker-urls-with-terser branch from e8e8743 to 1cca8e3 Compare October 1, 2026 01:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant