Skip to content

fix: prefer using Rspack/Rsbuild v2 config#470

Merged
fi3ework merged 6 commits intomainfrom
wtp/tree/sb-dev1
Apr 14, 2026
Merged

fix: prefer using Rspack/Rsbuild v2 config#470
fi3ework merged 6 commits intomainfrom
wtp/tree/sb-dev1

Conversation

@fi3ework
Copy link
Copy Markdown
Member

@fi3ework fi3ework commented Apr 14, 2026

Summary

  • Bump @rsbuild/core devDependencies to ^2.0.0-rc.2 across all packages and sandboxes
  • Bump sandbox plugins to Rsbuild v2 compatible versions (@rsbuild/plugin-react, @rsbuild/plugin-vue, @rsbuild/plugin-sass, @rsbuild/plugin-babel, @rspack/core, @rspack/cli, @rspack/plugin-react-refresh)
  • Migrate performance.chunkSplit to top-level splitChunks for Rsbuild v2, with runtime version detection (rspackMajorVersion) to preserve Rsbuild v1 compatibility
  • Add // Rspack v1 compatible: comments to all v1 compat code paths for consistency
  • All peerDependencies remain ^1.5.0 || ^2.0.0-0 — no major version bump for storybook-rsbuild

Test plan

  • pnpm build passes
  • pnpm build:sandboxes passes
  • pnpm check passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm e2e passes
  • Verify sandboxes work with Rsbuild v2.0.0-rc.2 at runtime

- Bump `@rsbuild/core` devDependencies to `^2.0.0-rc.2` across all packages
- Bump sandbox plugins to Rsbuild v2 compatible versions:
  - `@rsbuild/plugin-react` → `^2.0.0-rc.2`
  - `@rsbuild/plugin-vue` → `^2.0.0-alpha.3`
  - `@rsbuild/plugin-sass` → `^2.0.0-alpha.3`
  - `@rsbuild/plugin-babel` → `^2.0.0-alpha.3`
  - `@rspack/core` / `@rspack/cli` → `^2.0.0-rc.2`
  - `@rspack/plugin-react-refresh` → `^2.0.0`
- Migrate `performance.chunkSplit` to top-level `splitChunks` for Rsbuild v2,
  with runtime version detection to preserve Rsbuild v1 compatibility
- Add `// Rspack v1 compatible:` comments to all v1 compat code paths
- All peerDependencies remain `^1.5.0 || ^2.0.0-0` (no major version bump)
@fi3ework fi3ework changed the title chore(deps): upgrade Rsbuild/Rspack to 2.0.0-rc.2 fix: prefer using Rspack/Rsbuild v2 config Apr 14, 2026
Modern.js internally resolves a different version of @rsbuild/core,
causing RsbuildConfig type mismatch with mergeRsbuildConfig.
- Keep `performance.chunkSplit` for both v1 and v2 since
  `@rsbuild/plugin-vue@2.0.0-alpha.3` still reads `chunkSplit.strategy`
- Revert `@rsbuild/plugin-sass` to `^1.5.1` in rslib sandboxes (v2 alpha
  has breaking changes with sass module resolution)
- Revert `@rspack/plugin-react-refresh` to `^1.6.1` (v2 is ESM-only,
  incompatible with CJS rspack config)
Copy link
Copy Markdown

@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: 551e6e6a5f

ℹ️ 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 thread packages/builder-rsbuild/src/preview/iframe-rsbuild.config.ts Outdated
Comment thread packages/builder-rsbuild/src/preview/iframe-rsbuild.config.ts Outdated
- Convert `rspack.config.cjs` to `rspack.config.mjs` for
  `@rspack/plugin-react-refresh@2.0.0` ESM compatibility
- Use named export `ReactRefreshRspackPlugin` (v2 dropped default export)
- Keep `@rsbuild/plugin-sass@^1.5.1` in rslib sandboxes since
  `@rsbuild/plugin-sass@2.0.0-alpha.3` is too old for `@rsbuild/core@rc.2`
…plitChunks

- Use `rspack.rspackVersion` instead of `rspack.version` for major
  version detection. `rspack.version` returns the webpack-compat version
  (5.75.0), not the actual Rspack version.
- Remove top-level `splitChunks` config to avoid overriding user-provided
  `performance.chunkSplit` settings from rsbuild.config. When both are
  present, Rsbuild v2 ignores `performance.chunkSplit` entirely.
- Keep using `performance.chunkSplit` only, which is deprecated but still
  functional in Rsbuild v2, preserving v1 compatibility.
…ugin-vue

- Use rspackMajorVersion to conditionally apply `performance.chunkSplit` (v1)
  or top-level `splitChunks` (v2) instead of deprecated-but-functional fallback.
- Revert `@rsbuild/plugin-vue` to 1.2.7 in vue3/lit/rslib-vue3 sandboxes
  because alpha.3 crashes when `performance.chunkSplit` is absent in v2 branch.
@fi3ework fi3ework merged commit f12e47f into main Apr 14, 2026
10 checks passed
@fi3ework fi3ework deleted the wtp/tree/sb-dev1 branch April 14, 2026 14:26
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