During Legacy builds worker files are not generated with renderModernChunks
set to false
#18558
Open
7 tasks done
Labels
feat: web workers
p3-minor-bug
An edge case that only affects very specific usage (priority)
plugin: legacy
Describe the bug
I am trying to create a legacy-only build (no modern chunks) using the Legacy plugin that outputs working code which includes the web worker files.
What is happening is that when
renderModernChunks
is set to false the worker file is not created during the build but is still referenced inside the bundled code. WhenrenderModernChunks
is either set totrue
or absent from the config the worker files are generated correctly.This works correctly in
dev
modeFrom a cursory examination I found that if I removed the conditional inside the
legacyPostPlugin.configResolved
method the worker files are generated correctly and theindex.html
file is output correctly. I haven't had time to dig any deeper.Note: The reason I need a legacy only build is the HTML that is generated which supports both legacy and modern does not work on older browsers. This is a separate issue.
Reproduction
https://stackblitz.com/edit/vitejs-vite-zsxp4m?file=vite.config.js
Steps to reproduce
vite build
(ornpm run build
)/dist/assets
, no worker file exists/dist/assets/index-legacy-HASH.js
file to see reference to worker fileTesting
vite preview
ornpx serve dist
preview
mode console will log errors andserve
will display 404 errors for missing worker fileWith Modern
renderModernChunks
totrue
or remove completely fromvite.config.js
vite build
/dist/assets
, worker file existsDifference being the generated
index.html
fileSystem Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: