Skip to content

Commit ce796aa

Browse files
committed
Disable SWC loose mode for Stimulus compatibility
The loose: true mode in Shakapacker's default SWC config can cause issues with class method binding. Explicitly setting loose: false ensures that Stimulus controller methods are properly bound and can respond to events like turbo:submit-end.
1 parent eebfdec commit ce796aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

config/swc.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module.exports = {
1010
}
1111
},
1212
// Preserve ES6 classes for Stimulus compatibility
13-
keepClassNames: true
13+
keepClassNames: true,
14+
// Disable loose mode to ensure proper class method binding for Stimulus
15+
loose: false
1416
}
1517
};

0 commit comments

Comments
 (0)