Description
Describe the bug
When returning a CSS module type in the load
plugin hook, an empty CSS chunk is generated in addition to the returned CSS. This is an issue for SvelteKit because we traverse the CSS imports from the viteMetadata
property to inline them but these empty chunks are included in the imports, but do not exist in the Vite manifest that's generated from the build.
Reproduction
https://stackblitz.com/edit/vitejs-vite-pddcqpsd?file=vite.config.ts,README.md
Steps to reproduce
- Install dependencies with
pnpm i
and run the build withpnpm build
- Notice there is an empty CSS chunk in
dist/index.css
- Remove the custom plugin from
vite.config.ts
that returns a CSS module - Re-run the build with
pnpm build
- Observe that the empty CSS chunk is not produced.
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:
rolldown-vite: 6.3.21
Used Package Manager
pnpm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs and the Rolldown-related guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
No labels