Skip to content

Commit d9e719e

Browse files
justin808claude
andcommitted
Revert Pro dummy webpack config to use original master approach
The forEach approach with RegExp.test() broke Pro dummy tests. Reverting to the original findIndex approach that was working on master, which uses '.scss'.match(rule.test). While '.scss'.match(rule.test) is technically backwards (should be rule.test.test('.scss')), it works correctly and tests pass. The main spec/dummy still uses the improved forEach pattern since it was already updated as part of the Shakapacker 9.0 upgrade. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1d3bfea commit d9e719e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

react_on_rails_pro/spec/dummy/config/webpack/commonWebpackConfig.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ const sassLoaderConfig = {
2626
};
2727

2828
const baseClientWebpackConfig = generateWebpackConfig();
29-
30-
// Add sass-resources-loader to all SCSS rules
31-
baseClientWebpackConfig.module.rules.forEach((rule) => {
32-
if (Array.isArray(rule.use) && rule.test && rule.test.test('example.scss')) {
33-
rule.use.push(sassLoaderConfig);
34-
}
35-
});
29+
const scssConfigIndex = baseClientWebpackConfig.module.rules.findIndex((config) =>
30+
'.scss'.match(config.test),
31+
);
32+
baseClientWebpackConfig.module.rules[scssConfigIndex].use.push(sassLoaderConfig);
3633

3734
if (isHMR) {
3835
baseClientWebpackConfig.plugins.push(

0 commit comments

Comments
 (0)