-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathswc.config.js
More file actions
27 lines (25 loc) · 1 KB
/
swc.config.js
File metadata and controls
27 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { env } = require('shakapacker');
const customConfig = {
options: {
jsc: {
// Preserve class names for Stimulus controller discovery
keepClassNames: true,
// Use spec-compliant transforms (override Shakapacker's loose: true default)
// This is required for Stimulus controllers to work correctly
loose: false,
transform: {
react: {
// Use classic runtime for SSR compatibility with React on Rails
// This ensures React is explicitly imported in each component file, which
// provides better compatibility with server-side rendering in Rails.
// Classic runtime is more explicit and works reliably across all React versions.
// TODO: Consider switching to 'automatic' runtime when fully on React 19+
runtime: 'classic',
// Enable React Fast Refresh in development
refresh: env.isDevelopment && env.runningWebpackDevServer,
},
},
},
},
};
module.exports = customConfig;