Skip to content

Commit 21e9a2c

Browse files
justin808claude
andcommitted
Copy include/exclude from SWC rule to Babel rule
The Babel rule needs the same include/exclude logic as the SWC rule to ensure JavaScript files are properly processed. This includes the source_path and additional_paths while excluding node_modules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0be82af commit 21e9a2c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

config/webpack/commonWebpackConfig.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,16 @@ const commonWebpackConfig = () => {
8080
);
8181

8282
if (swcRuleIndex !== -1) {
83+
const swcRule = config.module.rules[swcRuleIndex];
84+
8385
// Change SWC rule to only handle TypeScript files
84-
config.module.rules[swcRuleIndex].test = /\.(ts|tsx)(\.erb)?$/;
86+
swcRule.test = /\.(ts|tsx)(\.erb)?$/;
8587

86-
// Add Babel loader for all JavaScript files
88+
// Add Babel loader for all JavaScript files, using the same include/exclude as SWC
8789
config.module.rules.push({
8890
test: /\.(js|jsx|mjs)(\.erb)?$/,
89-
exclude: /node_modules/,
91+
include: swcRule.include,
92+
exclude: swcRule.exclude,
9093
use: {
9194
loader: 'babel-loader',
9295
options: {

0 commit comments

Comments
 (0)