feat(plugin-babel): compatible with Rsbuild v1#7062
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello @chenjiahan, 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 enhances the Highlights
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
|
Deploying rsbuild with
|
| Latest commit: |
b8ee3a7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://85b9da42.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://babel-compat-v1-0126.rsbuild-v2.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request introduces compatibility for Rsbuild v1 in the Babel plugin. The changes correctly detect the Rsbuild version and adjust the webpack rule configuration accordingly. A new test case with a corresponding snapshot has been added to verify this compatibility. The changes look good overall. I've added one minor suggestion to improve type safety in the new test case.
There was a problem hiding this comment.
Pull request overview
This PR updates the Rsbuild Babel plugin to maintain compatibility with both Rsbuild v1 and v2, avoiding the need for a major version bump of the plugin itself. The changes detect the Rsbuild version at runtime and adjust the webpack chain configuration accordingly.
Changes:
- Added version detection logic to distinguish between Rsbuild v1 and v2 in the plugin setup
- Added test coverage for Rsbuild v1 compatibility using an aliased v1 dependency
- Updated dependencies to include Rsbuild v1 for testing purposes
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/plugin-babel/src/plugin.ts | Added version detection to conditionally access the JS rule directly (v1) or via oneOf (v2) |
| packages/plugin-babel/tests/index.test.ts | Added test case for Rsbuild v1 compatibility |
| packages/plugin-babel/tests/snapshots/index.test.ts.snap | Added snapshot for v1 test showing correct rule structure without oneOf |
| packages/plugin-babel/package.json | Added @rsbuild/core-v1 dev dependency for testing |
| pnpm-lock.yaml | Updated lockfile for new v1 test dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Updated the Babel plugin to detect Rsbuild v1 and adjust how the Babel loader is applied, ensuring correct rule configuration for both v1 and v2.
Related Links
Checklist