-
-
Notifications
You must be signed in to change notification settings - Fork 638
Closed
Labels
Description
Summary
Fix CSS Modules compatibility issues with Shakapacker 9.0.0+ to ensure existing import patterns continue to work.
Problem
Shakapacker 9.0+ defaults to namedExport: true for CSS Modules, which breaks existing code using:
import styles from './file.module.css'This causes errors because named exports expect:
import * as styles from './file.module.css'Proposed Solution
1. Configure CSS Modules for Backward Compatibility
Update webpack config to set:
loader.options.modules.namedExport = false;
loader.options.modules.exportLocalsConvention = 'camelCase';2. Fix SCSS Variable Issues
- Import app-variables in CSS Module files to prevent undefined variable errors
- Remove redundant @import statements
- Update both OSS and Pro dummy apps
3. Update Documentation
- Document CSS Modules configuration for Shakapacker 9+
- Add migration guide for upgrading projects
- Include troubleshooting section
Files to Update
From PR #1896 as reference:
spec/dummy/config/webpack/commonWebpackConfig.jsreact_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.jsspec/dummy/client/app/components/HelloWorld.module.scssreact_on_rails_pro/spec/dummy/client/app/components/HelloWorld.module.scss- CSS Modules documentation
Testing
- Test existing CSS Module imports work
- Verify SCSS variables are resolved
- Test in both OSS and Pro dummy apps
- Ensure no console errors or warnings
Related
- Extracted from closed PR Upgrade Shakapacker to 9.3.0 #1896
- Addresses compatibility with Shakapacker 9.0.0+
Labels
bug, enhancement