Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs/examples: framework-mode parity demo + less/sass notes#32

Merged
ScriptedAlchemy merged 1 commit intomainfrom
feat/framework-mode-parity-example
Feb 2, 2026
Merged

docs/examples: framework-mode parity demo + less/sass notes#32
ScriptedAlchemy merged 1 commit intomainfrom
feat/framework-mode-parity-example

Conversation

@ScriptedAlchemy
Copy link
Collaborator

This PR applies our stashed local work:

  • Update README to clarify that we aim to support RR v7 framework-mode behaviors (typegen, Route Module API, split route modules, SPA/SSR/prerender) on Rsbuild.
  • Update examples/default-template to explicitly demonstrate framework-mode style usage:
    • Adds a /styling route that imports *.module.less and *.module.scss
    • Adds @rsbuild/plugin-less + @rsbuild/plugin-sass in examples/default-template/rsbuild.config.ts
    • Adds Playwright coverage for the styling route to ensure styles are actually applied

Tested:

  • pnpm test
  • pnpm --filter default-template typecheck
  • pnpm --filter default-template build
  • pnpm --filter default-template test:e2e

@gemini-code-assist
Copy link

Summary of Changes

Hello @ScriptedAlchemy, 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 enhances the rsbuild-plugin-react-router example by demonstrating robust support for React Router's framework-mode behaviors, particularly focusing on styling with LESS and SASS CSS Modules. It clarifies the plugin's capabilities in the documentation and provides a concrete, tested example of preprocessor integration, ensuring that developers can leverage these features effectively within their Rsbuild projects.

Highlights

  • Framework Mode Documentation Update: The README has been updated to clarify that the Rsbuild plugin aims to provide equivalent behaviors to React Router's 'Framework Mode', including typegen, Route Module API types, route module splitting, and various rendering strategies (SPA/SSR/prerender), without direct reliance on Vite.
  • LESS/SASS CSS Modules Demo: A new /styling route has been added to the default-template example to explicitly demonstrate the usage and integration of LESS and SASS CSS Modules within the Rsbuild setup.
  • CSS Preprocessor Plugin Integration: The default-template example's rsbuild.config.ts now includes @rsbuild/plugin-less and @rsbuild/plugin-sass, enabling native support for these CSS preprocessors.
  • Playwright E2E Test for Styling: A new Playwright end-to-end test has been introduced to verify that the LESS and SASS module styles are correctly applied and rendered on the /styling route, ensuring functional correctness.
  • Improved Type Annotations: Several route components have had their useLoaderData and useFetcher type annotations updated to use Route.ComponentProps["loaderData"] and Route.ComponentProps["actionData"] for enhanced type safety and consistency.

🧠 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.

Changelog
  • README.md
    • Clarified Rsbuild plugin's support for React Router "Framework Mode" equivalent behaviors (typegen, Route Module API types, route module splitting, SPA/SSR/prerender strategies).
    • Detailed specific behaviors matched without Vite dependency.
  • examples/default-template/app/root.tsx
    • Added a "Styling" link to the main navigation.
  • examples/default-template/app/routes.ts
    • Registered a new /styling route.
  • examples/default-template/app/routes/client-features.tsx
    • Updated useLoaderData and useFetcher type annotations to Route.ComponentProps["loaderData"] and Route.ComponentProps["actionData"] respectively.
  • examples/default-template/app/routes/projects/edit.tsx
    • Updated breadcrumb function parameter type to Route.ComponentProps["loaderData"].
    • Updated useLoaderData type annotation to Route.ComponentProps["loaderData"].
  • examples/default-template/app/routes/projects/index.tsx
    • Updated useLoaderData type annotation to Route.ComponentProps["loaderData"].
    • Added any type annotation to recentActivity.map callback parameter.
  • examples/default-template/app/routes/projects/layout.tsx
    • Updated useLoaderData type annotation to Route.ComponentProps["loaderData"].
    • Added any type annotation to projects.map callback parameter.
  • examples/default-template/app/routes/projects/project.tsx
    • Updated breadcrumb function parameter type to Route.ComponentProps["loaderData"].
    • Updated useLoaderData type annotation to Route.ComponentProps["loaderData"].
    • Added any type annotation to project.team.map and project.activity.map callback parameters.
  • examples/default-template/app/routes/projects/settings.tsx
    • Updated breadcrumb function parameter type to Route.ComponentProps["loaderData"].
    • Updated useLoaderData type annotation to Route.ComponentProps["loaderData"].
  • examples/default-template/app/routes/styling.module.less
    • New file added, defining a .card style using LESS variables.
  • examples/default-template/app/routes/styling.module.scss
    • New file added, defining a .block style using SASS variables and nesting.
  • examples/default-template/app/routes/styling.tsx
    • New route component added to demonstrate the usage of LESS and SASS CSS Modules.
  • examples/default-template/package.json
    • Added @rsbuild/plugin-less and @rsbuild/plugin-sass as dev dependencies.
  • examples/default-template/rsbuild.config.ts
    • Imported pluginLess and pluginSass.
    • Added pluginLess() and pluginSass() to the Rsbuild plugins configuration.
    • Removed unused path import.
  • examples/default-template/tests/e2e/styling.test.ts
    • New Playwright E2E test added to verify that the LESS and SASS module styles are correctly applied on the /styling route.
  • pnpm-lock.yaml
    • Updated lockfile to reflect new dependencies for @rsbuild/plugin-less and @rsbuild/plugin-sass, including sass-embedded, @parcel/watcher related packages, loader-utils, reduce-configs, big.js, colorjs.io, emojis-list, immutable, node-addon-api, sync-child-process, sync-message-port, varint.
    • Updated express dependency version for @react-router/express.
    • Adjusted @types/node version in jest-worker snapshot.
Activity
  • The author performed local tests including pnpm test, pnpm --filter default-template typecheck, pnpm --filter default-template build, and pnpm --filter default-template test:e2e to ensure the changes are functional and do not introduce regressions.
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.

@ScriptedAlchemy ScriptedAlchemy merged commit 046d6d4 into main Feb 2, 2026
4 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the feat/framework-mode-parity-example branch February 2, 2026 23:42
Copy link

@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 is a solid update that improves documentation regarding framework-mode parity and adds a valuable example for less and scss styling, complete with e2e tests. The type updates from Route.LoaderData to Route.ComponentProps["loaderData"] are a good move towards better type safety. However, I've identified a few instances where any has been used to resolve type inference issues, which compromises type safety. My review includes specific suggestions to address these points for improved code quality and maintainability.

</h2>
<div className="space-y-4">
{recentActivity.map((activity) => (
{recentActivity.map((activity: any) => (

Choose a reason for hiding this comment

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

medium

Using any here bypasses type checking and is not ideal for maintainability. It seems the type of activity is not being inferred correctly from recentActivity. To maintain type safety, it would be better to explicitly define the type for an activity item or fix the type inference from useLoaderData. You could extract the type from the loader's return type in the generated types file, for example:

import type { Route } from './+types/index';

type Activity = Route.ComponentProps["loaderData"]["recentActivity"][number];

// ...

{recentActivity.map((activity: Activity) => (
  // ...
))}

If this isn't feasible, defining the type manually is still preferable to using any.

Suggested change
{recentActivity.map((activity: any) => (
{recentActivity.map((activity) => (


<nav className="space-y-1">
{projects.map((project) => (
{projects.map((project: any) => (

Choose a reason for hiding this comment

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

medium

Using any for the project parameter is not ideal as it bypasses type safety. Please consider defining a proper type for project or ensuring it's correctly inferred from useLoaderData to improve maintainability and prevent potential runtime errors.

Suggested change
{projects.map((project: any) => (
{projects.map((project) => (

</h2>
<div className="space-y-4">
{project.team.map((member) => (
{project.team.map((member: any) => (

Choose a reason for hiding this comment

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

medium

Using any for the member parameter reduces type safety. It would be better to define a proper type for member or ensure it's correctly inferred from the project.team data to make the component more robust and easier to maintain.

Suggested change
{project.team.map((member: any) => (
{project.team.map((member) => (

</h2>
<div className="space-y-4">
{project.activity.map((item) => (
{project.activity.map((item: any) => (

Choose a reason for hiding this comment

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

medium

Using any for the item parameter is not ideal as it bypasses type checking. Please consider defining a proper type for item or ensuring it's correctly inferred from project.activity to improve type safety and code clarity.

Suggested change
{project.activity.map((item: any) => (
{project.activity.map((item) => (

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ba0d3395f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +17 to +21
plugins: [
pluginReactRouter({ serverOutput: 'commonjs' }),
pluginReact(),
pluginLess(),
pluginSass(),

Choose a reason for hiding this comment

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

P2 Badge Add less dependency for pluginLess usage

With pluginLess() enabled and a *.module.less route in this template, a clean install will try to compile LESS but less itself isn’t declared in examples/default-template/package.json (and doesn’t appear in the lockfile). @rsbuild/plugin-less doesn’t vendor the compiler, so the dev server/build will fail with a missing less module on fresh installs. Add less to the template’s devDependencies or drop the LESS usage to keep the example runnable.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant