Open christowiz opened 1 week ago
Is this the same as https://github.com/vitejs/vite/issues/16639 (but english)?
Is this the same as #16639 (but english)?
I guess it is (after viewing the translation). Looks like that is from May 8th with no comments.
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