Skip to content

Commit 7aaeb26

Browse files
committed
Keep Pro dummy app with Babel, only use SWC in spec/dummy
- Revert react_on_rails_pro/spec/dummy back to Babel transpiler - Remove SWC config from Pro dummy app - Update documentation to clarify only spec/dummy uses SWC - Pro app stays with Babel for RSC stability This provides a safer migration path where standard React on Rails apps can benefit from SWC's 20x performance improvement, while Pro apps with React Server Components maintain stability with Babel until SWC RSC support matures.
1 parent e29600d commit 7aaeb26

File tree

3 files changed

+7
-33
lines changed

3 files changed

+7
-33
lines changed

docs/swc-migration.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ SWC (Speedy Web Compiler) is a Rust-based JavaScript/TypeScript compiler that is
1010

1111
## Migration Steps
1212

13+
**Note**: This migration has been successfully implemented in the React on Rails standard dummy app (`spec/dummy`). The Pro dummy app (`react_on_rails_pro/spec/dummy`) continues using Babel for RSC stability.
14+
1315
### 1. Install Required Dependencies
1416

1517
```bash
@@ -27,7 +29,7 @@ default: &default # Using SWC for faster JavaScript transpilation (20x faster th
2729
2830
### 3. Create SWC Configuration File
2931
30-
Create `config/swc.config.js` with the following content:
32+
Create `config/swc.config.js` in your Rails application root with the following content:
3133

3234
```javascript
3335
const { env } = require('shakapacker');
@@ -203,7 +205,9 @@ Test coverage includes:
203205

204206
**For React on Rails projects without React Server Components**: ✅ **Migration to SWC is recommended**
205207

206-
**For projects using React Server Components**: ⚠️ **Proceed with caution** - consider staying with Babel until SWC RSC support stabilizes, or conduct extensive testing before production deployment.
208+
The standard React on Rails dummy app (`spec/dummy`) successfully uses SWC, demonstrating its compatibility with core React on Rails features.
209+
210+
**For projects using React Server Components**: ⚠️ **Stay with Babel for now** - The React on Rails Pro dummy app continues using Babel due to RSC's experimental status with SWC. Consider staying with Babel until SWC RSC support stabilizes, or conduct extensive testing before production deployment.
207211

208212
## References
209213

react_on_rails_pro/spec/dummy/config/shakapacker.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ default: &default
66
public_root_path: public
77
public_output_path: packs
88
nested_entries: true
9-
# Using SWC for faster JavaScript transpilation (20x faster than Babel)
10-
javascript_transpiler: swc
9+
javascript_transpiler: babel
1110

1211
cache_path: tmp/cache/webpacker
1312
check_yarn_integrity: false

react_on_rails_pro/spec/dummy/config/swc.config.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)