You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Hey @MoritzLoewenstein, Vite skips empty CSS files during build. You can add a dummy class (like :root {}) to make sure it's processed and output as a .css file.
Hey @nakul-py ,
this is true, but when using lightningcss as the css transformer the same thing happens for every css file that minifies to an empty file (which may not always be obvious): vite-empty-css-fzjoe4md-k3rcgpsn
Note: lightningcss does not seem to work on stackblitz, only the vite config changed from the previous reproduction.
This will "work" in the sense that it will generate a css output file, my issue is that I am building a custom vite php integration which will read the manifest. It just seems illogical that a css/scss entry can generate a js output in any case. If that is expected I will handle it in my integration, I was just thinking that it seems unintuitive / appears to be a bug.
What I am doing
Empty CSS (or SCSS) file as input in vite rollupOptions config.
What i expect to happen
I expected either no output for this file (and no manifest entry),
or an empty css file output and a manifest entry like this:
What is actually happening
Vite generates an empty js file as output when running
vite build
, e.g. this manifest entry:Note: the stackblitz reproduction does error when compiling scss, but the same thing happens when building an empty scss file.
Reproduction
https://stackblitz.com/edit/vite-empty-css-fzjoe4md?file=vite.config.js
Steps to reproduce
Run
npm install
followed bynpm run build
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 20.19.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.8.2 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vite: ^6.3.3 => 6.3.3
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: