Install @babel/preset-react for non-SWC generator installs#2421
Install @babel/preset-react for non-SWC generator installs#2421
Conversation
WalkthroughThe generator now installs Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes a missing dependency issue where the generator creates a Key Changes:
Why This Matters: Confidence Score: 5/5
Important Files Changed
Flowchartflowchart TD
A[Generator starts] --> B[add_js_dependencies called]
B --> C{using_swc?}
C -->|true| D[add_swc_dependencies]
C -->|false| E[add_babel_react_dependencies]
D --> F[Install @swc/core and swc-loader as devDependencies]
E --> G[Install @babel/preset-react as devDependency]
F --> H[Continue with other dependencies]
G --> H
H --> I[babel.config.js template requires @babel/preset-react]
I --> J{SWC path?}
J -->|Yes| K[No babel.config.js needed - SWC handles transpilation]
J -->|No| L[babel.config.js uses @babel/preset-react preset]
Last reviewed commit: ff49925 |
Summary
BABEL_REACT_DEPENDENCIESto the generator dependency manager@babel/preset-reactas a dev dependency when SWC is not the active transpiler@babel/preset-reactfor older Shakapacker/Babel defaultsCloses #2281
Test plan
bundle exec rspec react_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rbbundle exec rspec react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb2.6.10) vs project requirement (>= 3.0.0)Summary by CodeRabbit
New Features
Tests