fix(start-rsbuild): compile node_modules for RSC directives#7540
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds a complete end-to-end test suite for React Start with Rsbuild and React Server Components. It establishes a workspace under ChangesReact Start RSC E2E Test Suite
Rsbuild Plugin RSC Enhancement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@e2e/react-start/rsc-rsbuild/server.js`:
- Around line 23-24: The function that computes serverJsPath currently returns
serverJsPath even when no artifact exists, causing later failures; instead, in
the code that determines/returns serverJsPath (the variable named serverJsPath
and its containing function), check for existence of both candidate files
(dist/server/server.js and dist/server/index.js) and if neither exists throw an
explicit Error with a clear message like "Server build artifact not found:
expected dist/server/server.js or dist/server/index.js"; replace the plain
return of serverJsPath with this existence check and throw to fail fast.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 03e57728-1881-4f0c-a4c1-4318f6057c9d
⛔ Files ignored due to path filters (4)
e2e/react-start/rsc-rsbuild/src/node_modules/rsc-client-pkg/index.d.tsis excluded by!**/node_modules/**e2e/react-start/rsc-rsbuild/src/node_modules/rsc-client-pkg/index.jsis excluded by!**/node_modules/**e2e/react-start/rsc-rsbuild/src/node_modules/rsc-client-pkg/package.jsonis excluded by!**/node_modules/**pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
e2e/react-start/rsc-rsbuild/.gitignoree2e/react-start/rsc-rsbuild/.prettierignoree2e/react-start/rsc-rsbuild/package.jsone2e/react-start/rsc-rsbuild/playwright.config.tse2e/react-start/rsc-rsbuild/rsbuild.config.tse2e/react-start/rsc-rsbuild/server.jse2e/react-start/rsc-rsbuild/src/routeTree.gen.tse2e/react-start/rsc-rsbuild/src/router.tsxe2e/react-start/rsc-rsbuild/src/routes/__root.tsxe2e/react-start/rsc-rsbuild/src/routes/index.tsxe2e/react-start/rsc-rsbuild/src/routes/rsc-node-module-client.tsxe2e/react-start/rsc-rsbuild/src/utils/RscClientPkgContent.tsxe2e/react-start/rsc-rsbuild/src/utils/nodeModuleClientServerComponent.tsxe2e/react-start/rsc-rsbuild/tests/hydration.tse2e/react-start/rsc-rsbuild/tests/rsc-node-module-client.spec.tse2e/react-start/rsc-rsbuild/tests/setup/global.setup.tse2e/react-start/rsc-rsbuild/tests/setup/global.teardown.tse2e/react-start/rsc-rsbuild/tsconfig.jsonpackages/start-plugin-core/src/rsbuild/plugin.ts
| return serverJsPath | ||
| } |
There was a problem hiding this comment.
Fail fast when no server build artifact exists.
If neither dist/server/server.js nor dist/server/index.js exists, returning serverJsPath hides the root cause and fails later inside srvx. Throw an explicit error here.
Proposed fix
function resolveDistServerEntryPath() {
const serverJsPath = path.resolve(distDir, 'server', 'server.js')
if (fs.existsSync(serverJsPath)) {
return serverJsPath
}
const indexJsPath = path.resolve(distDir, 'server', 'index.js')
if (fs.existsSync(indexJsPath)) {
return indexJsPath
}
- return serverJsPath
+ throw new Error(
+ `Server entry not found. Looked for "${serverJsPath}" and "${indexJsPath}". Did you run the build first?`,
+ )
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@e2e/react-start/rsc-rsbuild/server.js` around lines 23 - 24, The function
that computes serverJsPath currently returns serverJsPath even when no artifact
exists, causing later failures; instead, in the code that determines/returns
serverJsPath (the variable named serverJsPath and its containing function),
check for existence of both candidate files (dist/server/server.js and
dist/server/index.js) and if neither exists throw an explicit Error with a clear
message like "Server build artifact not found: expected dist/server/server.js or
dist/server/index.js"; replace the plain return of serverJsPath with this
existence check and throw to fail fast.
|
View your CI Pipeline Execution ↗ for commit b443e2e
☁️ Nx Cloud last updated this comment at |
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
node_modulesduring Rsbuild RSC builds so SWC can detect RSC directives such as"use client", while excludingcore-jsper Rsbuild guidance.node_modulesand verifies SSR, hydration, and client interaction.Summary by CodeRabbit
New Features
Tests
Chores