Skip to content

Drop babel-plugin-react-css-modules #1087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2025
Merged

Drop babel-plugin-react-css-modules #1087

merged 2 commits into from
Jun 18, 2025

Conversation

Mr0grog
Copy link
Member

@Mr0grog Mr0grog commented Jun 18, 2025

This drops the babel-plugin-react-css-modules package and instead uses css-loader directly to get CSS modules functionality. The Babel plugin provided some nice, convenient syntax, but hasn’t been well maintained. Its approach also causes frequent breakage because it needs to keep in sync with private aspects of css-loader, so I’ve dropped it instead of moving to a maintained fork, which works but has the same fundamental issues. See #581 for more discussion.

This also changes test snapshots slightly — with the Babel plugin, the selector re-naming is done by Babel and happens during tests. Without the Babel plugin, re-naming is done by Webpack, and does not actually run during Jest tests. So instead we have a little mock that just gives you back the selector name you asked for as a string.

Mr0grog added 2 commits June 17, 2025 17:30
File-loader is deprecated and we no longer use it, but still had it hanging around as a dependency. This removes it and also updates postcss, since I am currently working in that area.
Also upgrade css-loader to the current release. Fixes #581.
@Mr0grog Mr0grog linked an issue Jun 18, 2025 that may be closed by this pull request
@Mr0grog Mr0grog merged commit 0f68814 into main Jun 18, 2025
5 checks passed
@Mr0grog Mr0grog deleted the trapped-in-a-css-box branch June 18, 2025 23:59
@github-project-automation github-project-automation bot moved this from Inbox to Done in Web Monitoring Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Resolve css-loader v4 + babel-plugin-react-css-modules incompatibility
1 participant