fix: prefer using Rspack/Rsbuild v2 config#470
Merged
Conversation
- 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)
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)
There was a problem hiding this comment.
💡 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".
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@rsbuild/coredevDependencies to^2.0.0-rc.2across all packages and sandboxes@rsbuild/plugin-react,@rsbuild/plugin-vue,@rsbuild/plugin-sass,@rsbuild/plugin-babel,@rspack/core,@rspack/cli,@rspack/plugin-react-refresh)performance.chunkSplitto top-levelsplitChunksfor Rsbuild v2, with runtime version detection (rspackMajorVersion) to preserve Rsbuild v1 compatibility// Rspack v1 compatible:comments to all v1 compat code paths for consistency^1.5.0 || ^2.0.0-0— no major version bump for storybook-rsbuildTest plan
pnpm buildpassespnpm build:sandboxespassespnpm checkpassespnpm lintpassespnpm testpassespnpm e2epasses