feat(plugin-svgr): compatible with Rsbuild v1#7061
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 introduces compatibility for 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: |
f7bd573
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://92309c02.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://svgr-compat-v1-0126.rsbuild-v2.pages.dev |
There was a problem hiding this comment.
Code Review
The pull request successfully introduces compatibility for Rsbuild v1 within the pluginSvgr. The implementation correctly identifies the Rsbuild version and applies the appropriate JS transform rules for SVG files. The addition of @rsbuild/core-v1 as a dev dependency and the new test cases for Rsbuild v1 compatibility demonstrate a thorough approach to ensuring backward compatibility. All changes are well-aligned with the PR's objective and appear to be correctly implemented and tested.
There was a problem hiding this comment.
Pull request overview
Updates @rsbuild/plugin-svgr to work with both Rsbuild v1 and v2 by selecting the appropriate JS rule shape when inheriting the project’s JS transform loader(s) for SVG → React component handling.
Changes:
- Detect Rsbuild v1 via
api.context.versionand apply JS transform loader(s) from the correct chain rule shape. - Add Rsbuild v1 test coverage by running the same SVGR rule snapshots against
@rsbuild/[email protected]via an alias package. - Update snapshots and lockfile to reflect the new compatibility test matrix.
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 |
|---|---|
| pnpm-lock.yaml | Adds locked dependency entry for @rsbuild/core-v1 (alias to Rsbuild v1) used by tests. |
| packages/plugin-svgr/package.json | Adds @rsbuild/core-v1 devDependency to run compatibility tests against Rsbuild v1. |
| packages/plugin-svgr/src/index.ts | Switches JS rule selection logic to support both v1 (no JS oneOf) and v2 (JS main oneOf). |
| packages/plugin-svgr/tests/index.test.ts | Runs the existing SVGR snapshot cases against both Rsbuild v2 and Rsbuild v1. |
| packages/plugin-svgr/tests/snapshots/index.test.ts.snap | Adds/updates snapshots for the new Rsbuild v1 test cases. |
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
pluginSvgrimplementation to detect Rsbuild v1 and adjust how JS transform rules are applied for SVG files, ensuring compatibility with both Rsbuild v1 and v2.Related Links
Checklist