Skip to content

Conversation

@bhollis
Copy link
Contributor

@bhollis bhollis commented Oct 12, 2025

css-loader changed its defaults a while back to export each class name as a separate named export, which enables some tree-shaking and inlining optimizations that otherwise wouldn't be possible. But the loader that produces .d.ts files for CSS modules never updated to support it.

I actually went through the trouble of forking and publishing an updated version of the loader we used before finding that someone had already done it.

The main change for us is:

  1. We need to import styles with import * as styles instead of import styles.
  2. We have to avoid JS keywords in class names until Support class names that conflict with JS keywords Ch-Valentine/css-modules-dts-loader#1 is fixed.

@bhollis
Copy link
Contributor Author

bhollis commented Oct 12, 2025

There's a problem here - eslint-plugin-css-modules doesn't work for this style of import. I may have to fork it and fix it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants