Closed davidmz closed 3 months ago
@davidmz Why the input is .html
file? Try the .js
file directly.
It's important to note that this only happens with build.cssCodeSplit: false
. Vite seems to generate a qa-item.<hash>.js
mapping the source qa-item.css
. And if you set build.minify: false
, you can see there is content in the qa-item.<hash>.js
file, which is simply var qaItem = "";
. After esbuild minifies and removes it, the file becomes empty which comes to this issue.
For us this happens with build.cssCodeSplit: false
for lazily loaded JS files (import()
) which only import CSS files.
Reproduction Code: https://github.com/thasmo/vite-6913
Anyone find a resolution to this?
Hasn't been resolved yet?
Hi, I have the same problem now.
I get a file dev-html-ddf0fdd4.js
since my source files are inside dev/html/ with the content:
/* empty css */
Describe the bug
In some conditions,
vite build
generates an empty js file that has no source. I tried to create a minimal reproduction, please see the attached link to stackblitz.Run
vite build
(or just see an existing 'dist' folder there). It generates an empty 'assets/qa-item.00ef0854.js' file that is used in generated page1.html and page2.html. But the sources of these files has no js links.Reproduction
https://stackblitz.com/edit/vitejs-vite-1fn6ez
System Info
Used Package Manager
npm
Logs
No response
Validations