Skip to content

Comments

feat(plugin-svelte): compatible with Rsbuild v1#7063

Merged
chenjiahan merged 1 commit intomainfrom
svelte_compat_v1_0127
Jan 27, 2026
Merged

feat(plugin-svelte): compatible with Rsbuild v1#7063
chenjiahan merged 1 commit intomainfrom
svelte_compat_v1_0127

Conversation

@chenjiahan
Copy link
Member

Summary

Updated the Svelte plugin to detect Rsbuild v1 and adjust how it configures JS rules, ensuring compatibility with both v1 and v2.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 27, 2026 03:43
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 significantly improves the Svelte plugin by enabling it to function correctly across different versions of Rsbuild. It introduces a version detection mechanism to dynamically apply the appropriate JavaScript rule configurations, ensuring a consistent and reliable experience for users regardless of whether they are on Rsbuild v1 or v2.

Highlights

  • Rsbuild v1 Compatibility: The Svelte plugin now includes logic to detect Rsbuild v1 and adjust its JavaScript rule configuration accordingly, ensuring compatibility with both v1 and v2 environments.
  • New Development Dependency: Added @rsbuild/core-v1 as a development dependency to facilitate testing and ensure proper integration with Rsbuild v1.
  • Enhanced Test Coverage: New test cases and corresponding snapshots have been introduced to specifically validate the Svelte plugin's behavior and configuration when operating under an Rsbuild v1 context.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates @rsbuild/plugin-svelte to remain compatible with both Rsbuild v1 and v2 by detecting the major version at runtime and adjusting how it locates the “main JS rule” in the bundler chain.

Changes:

  • Add Rsbuild v1 compatibility logic when accessing the JS rule / JS main rule in the plugin’s bundler-chain modification.
  • Add a dedicated test case (and snapshots) that runs the plugin against Rsbuild v1 via an aliased devDependency.
  • Add @rsbuild/core-v1 alias dependency for test/runtime validation in the plugin workspace.

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 lock entries for the aliased @rsbuild/core-v1 dependency used by tests.
packages/plugin-svelte/package.json Adds @rsbuild/core-v1 as a devDependency alias to test against Rsbuild v1.
packages/plugin-svelte/src/index.ts Detects Rsbuild v1 and uses jsRule directly instead of jsRule.oneOfs.get(JS_MAIN).
packages/plugin-svelte/tests/index.test.ts Adds a new test that runs the plugin using Rsbuild v1 (createRsbuildV1).
packages/plugin-svelte/tests/snapshots/index.test.ts.snap Adds snapshots for the new Rsbuild v1 test expectations.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Svelte plugin to be compatible with Rsbuild v1 by adding a new dev dependency and adjusting the JS rules configuration. The changes also include adding a new test case and updating snapshots. I have identified a potential issue with the conditional logic for determining the JS rule and have provided a code suggestion to improve its clarity.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2fc8661
Status:🚫  Deploy failed.

View logs

@chenjiahan chenjiahan merged commit 29e6a79 into main Jan 27, 2026
12 of 13 checks passed
@chenjiahan chenjiahan deleted the svelte_compat_v1_0127 branch January 27, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant