-
Notifications
You must be signed in to change notification settings - Fork 844
Webpack config: Add local name for css module classes for development for easier debugging #46300
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
Webpack config: Add local name for css module classes for development for easier debugging #46300
Conversation
… for easier debugging.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the webpack configuration for CSS modules to improve developer experience during debugging. It adds a default configuration that retains human-readable local class names in development builds (e.g., button--a1b2c instead of just a1b2c), making it easier to identify and debug CSS module classes in browser DevTools.
Key Changes:
- Adds default CSS modules configuration with
auto: trueto enable automatic CSS module detection for files with.module.*in their names - Implements environment-aware
localIdentNamepatterns: readable names in development, hashed names in production
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| projects/js-packages/webpack-config/src/webpack/css-rule.js | Adds default modules configuration with auto-detection and development-friendly class names |
| projects/js-packages/webpack-config/changelog/add-local-name-for-css-module-classes-for-dev | Documents the enhancement as a patch-level added feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const isDevelopment = process.env.NODE_ENV !== 'production'; | ||
|
|
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition of isDevelopment here is inconsistent with the pattern used elsewhere in the webpack config package. In webpack.js and babel.js, the pattern is to define isProduction first, then derive isDevelopment from it. Consider changing this to match that pattern for consistency.
| const isDevelopment = process.env.NODE_ENV !== 'production'; | |
| const isProduction = process.env.NODE_ENV === 'production'; | |
| const isDevelopment = !isProduction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't bother with this AI "fix".
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
anomiex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, and no noteworthy changes in the build artifacts.
Currently, when working with CSS modules, the generated class names are base64 hash which are unreadable while debugging. So, it is helpful to have the classnames retained during development.
Slack: p1764235570543949-slack-C05Q5HSS013
Proposed changes:
localIdentNamefor CSS modules for development.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
jetpack watch plugins/jetpackjetpack build plugins/jetpack