build(website): build with rolldown and swc#1071
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughThis PR migrates the server bundling process from esbuild to Rolldown with SWC minification. Three new dependencies are added ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
Summary of ChangesHello @TheAlexLichter, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the website server's build pipeline by switching the primary bundling tool from esbuild to Rolldown, leveraging SWC for compilation and minification. This strategic move is designed to enhance the efficiency and output size of the server-side JavaScript bundle, contributing to overall performance improvements. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request migrates the website server's bundling process from esbuild to Rolldown with SWC, aiming for a smaller bundle size. The changes are concentrated in the build script and package configuration files. My review highlights a few key areas for improvement:
- Dependency Management: Build-time tools should be in
devDependencies. - Build Configuration: The Rolldown configuration can be simplified by removing a redundant plugin.
- Code Safety: The tree-shaking options are very aggressive and could lead to incorrect builds.
- Code Style: There's a minor style inconsistency in function declarations.
Overall, this is a good step towards optimizing the build, and with a few adjustments, it will be ready to merge.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
website/server/package.json (1)
31-31: Remove unused esbuild dependency.The
esbuilddependency is no longer used after migrating to Rolldown. Consider removing it to keep the dependencies clean and reduce potential confusion.🔎 Proposed fix
"devDependencies": { "@types/node": "^24.10.4", "@typescript/native-preview": "^7.0.0-dev.20251226.1", - "esbuild": "^0.27.2", "rimraf": "^6.1.2", "tsx": "^4.21.0", "typescript": "^5.9.3" }website/server/scripts/bundle.mjs (1)
14-14: Add missing semicolon for consistency.Line 14 is missing a trailing semicolon, which is inconsistent with the semicolon usage on line 13 and throughout the rest of the file.
🔎 Proposed fix
-import { swc, defineRollupSwcOption } from 'rollup-plugin-swc3' +import { swc, defineRollupSwcOption } from 'rollup-plugin-swc3';
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
website/server/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
website/server/package.jsonwebsite/server/scripts/bundle.mjs
🔇 Additional comments (1)
website/server/scripts/bundle.mjs (1)
49-55: Tree-shaking configuration is validated at build time.The aggressive tree-shaking settings are intentional and already tested through the bundled build process. The
warmup.mjsscript imports the entire bundledserver.mjsduring Docker build, which would fail if tree-shaking broke critical module initialization, property access, or side effects. This validation happens for every build, and the configuration is working correctly in production deployments.
…cies Sync package-lock.json with package.json to fix npm ci error during Docker build.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1071 +/- ##
=======================================
Coverage 87.19% 87.19%
=======================================
Files 116 116
Lines 4350 4350
Branches 1011 1011
=======================================
Hits 3793 3793
Misses 557 557 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@TheAlexLichter Once this fix is available in Rolldown, I plan to remove the SWC plugin and switch to oxc. |
Bundles with Rolldown + swc as minifier via plugin.
This yields a
4.7Mserver.mjsfor me.