-
-
Notifications
You must be signed in to change notification settings - Fork 8k
CSS Modules doesn't error on missing composes #16075
Copy link
Copy link
Open
Labels
Description
Describe the bug
When composing a class from another file in CSS Modules, an error is not emitted if the class is not found.
This is akin to not erroring when trying to import a missing export from another JS file, and can lead to bugs.
This is fixed by #16018, but wanted to file it for tracking purposes since this seems like a pretty major issue that wasn't reported.
(Originally reported in privatenumber/vite-css-modules#2)
Reproduction
Steps to reproduce
- In
style.modules.css, observe thatlarge-textis imported from./utils.module.css - In
utils.module.css, observe that it's an empty file - In the DOM, observe that
undefinedis passed in as a class:

System Info
N/AUsed Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- 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.
- 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.
Reactions are currently unavailable