-
-
Notifications
You must be signed in to change notification settings - Fork 638
Upgrade to Shakapacker 9.0.0.beta.11 and migrate to SWC #1847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Update shakapacker from 8.2.0 to 9.0.0.beta.11 - Migrate from Babel to SWC transpiler for ~20x faster transpilation - Remove Babel-related packages and configuration - Add SWC dependencies (@swc/core, swc-loader) - Configure SWC in shakapacker.yml for all environments - Add config/swc.config.js for custom SWC configuration - Remove babel.config.js as it's no longer needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Warning Rate limit exceeded@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 27 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughSwitches the dummy app from Babel to SWC. Removes the Babel config, adds an SWC config, updates shakapacker.yml to enable SWC per environment, bumps Shakapacker to 9.0.0.beta.11, and adjusts package.json to drop Babel dependencies and add SWC equivalents. Updates Gemfile development dependency for Shakapacker. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant SP as Shakapacker (v9)
participant Bundler as Webpack/Rspack
participant SWC as SWC Loader
participant Browser as Browser
Dev->>SP: run dev server / build
SP->>Bundler: initialize build with config (swc: true)
Bundler->>SWC: transpile TS/JSX (React runtime: automatic)
SWC-->>Bundler: transpiled assets
Bundler-->>SP: bundled output
SP-->>Browser: serve assets (HMR if enabled)
note over SWC,Bundler: New/changed: SWC replaces Babel pipeline
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
PR Review: Upgrade to Shakapacker 9.0.0.beta.11 and migrate to SWC✅ Positive AspectsGood migration approach: Using the official Shakapacker migration tasks ( Performance benefits: The 20x performance improvement from SWC is significant and will benefit both development and CI workflows. Clean dependency removal: All Babel-related packages have been properly removed without leaving orphaned dependencies. Proper SWC configuration: The 🔍 Issues & Concerns1. CRITICAL: Version Inconsistency in package.jsonLocation: The "shakapacker": "8.2.0", But should be updated to Recommendation: Update line 48 in "shakapacker": "9.0.0.beta.11", 2. Beta Version in ProductionUsing a beta version (
Recommendation:
3. Missing Migration DocumentationFor users upgrading React on Rails, there's no clear documentation about:
Recommendation: Add upgrade notes to the CHANGELOG or migration guide. 4. Potential React Refresh CompatibilityThe PR removes Babel but keeps Recommendation:
5. YAML Configuration DuplicationLocation: The YAML configuration has significant duplication across environments (development, test, production). While this is how the migration tool generated it, it reduces maintainability. Observation: This appears to be the standard Shakapacker 9 format (removed YAML anchors/aliases except for 🧪 Testing RecommendationsBefore merging, verify:
🔒 Security ConsiderationsNo security concerns identified. The upgrade removes dependencies, reducing attack surface. 📊 Test CoverageTest plan incomplete: The PR description shows "CI checks passing" is unchecked. This must be completed before merge. Recommendation:
📝 Code QualityCode quality: ✅ Good
Convention compliance: ✅ Follows CLAUDE.md requirements
🎯 SummaryRecommendation: APPROVE with required changes Must fix before merge:
Should consider:
The migration is well-executed overall, but the package.json version inconsistency must be fixed, and thorough testing is required before merging a beta version dependency. |
- Update spec/dummy/package.json shakapacker dependency from 8.2.0 to 9.0.0.beta.11 - This matches the Gemfile update in the previous commit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: Upgrade to Shakapacker 9.0.0.beta.11 and migrate to SWC✅ Overall AssessmentThis is a well-executed migration that brings significant performance improvements. The changes are clean, focused, and follow the Shakapacker migration guidelines. However, there are a few items that need attention before merging. 🔴 Critical Issues1. The package still has "@babel/core": "7.17.9", // ← Should be removed Why it matters: Keeping unused dependencies increases bundle size and can cause confusion about which transpiler is being used. Recommendation: Remove this from
|
- Remove @babel/core direct dependency (still used by Jest, which is fine) - Add React Refresh configuration to swc.config.js: - Enable development mode in development environment - Enable Fast Refresh for hot module replacement - This ensures React Fast Refresh works properly with SWC 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Restore all useful comments explaining configuration options - Use YAML anchor syntax (&default, <<: *default) for cleaner inheritance - Add comment explaining SWC transpiler usage - Improves developer experience and maintainability The migration task had removed these comments, but they provide valuable context for developers working with the configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change refresh condition from NODE_ENV === 'development' to WEBPACK_SERVE - This ensures Fast Refresh only activates when using webpack-dev-server (bin/dev) - Avoids unnecessary Fast Refresh transformation for static builds (bin/shakapacker) - Matches the behavior of ReactRefreshWebpackPlugin in development.js The WEBPACK_SERVE environment variable is set by webpack-dev-server and is the correct indicator for when HMR and Fast Refresh should be active. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: Shakapacker 9.0.0.beta.11 + SWC MigrationI've reviewed this pull request and here's my feedback: Strengths
Observations & ConsiderationsBeta Version Risk: Using 9.0.0.beta.11 in a library carries risk. Consider adding release notes warning. Missing PropTypes Optimization: The removed babel-plugin-transform-react-remove-prop-types was stripping PropTypes in production. With SWC, this optimization is lost, leading to slightly larger bundle sizes. Consider adding SWC equivalent transform or documenting this trade-off. Testing Coverage: PR mentions linters passing but no mention of actual functionality testing (SSR, client rendering). Recommend running full test suite. Breaking Change Documentation: This is significant toolchain change. Consider adding migration guide for users. Potential Issues
Security & Performance
Recommendations Before Merge
Code Quality Score: 8.5/10Overall: High-quality migration with significant build performance improvements. Main concerns are beta stability and PropTypes optimization loss. Once CI passes and recommendations addressed, should be good to merge. Great work on the clean migration! Generated with Claude Code |
Summary
Changes
swc: true
to all environments inconfig/shakapacker.yml
config/swc.config.js
for SWC-specific configurationbabel.config.js
Performance Benefits
Test Plan
rails shakapacker:migrate_to_swc
rails shakapacker:clean_babel_packages
🤖 Generated with Claude Code
This change is
Summary by CodeRabbit