fix(core): send asynchronous warnings to the socketServer#6671
fix(core): send asynchronous warnings to the socketServer#6671chenjiahan merged 5 commits intoweb-infra-dev:mainfrom
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where asynchronous TypeScript warnings from the TypeScript checker plugin were not being sent to the browser's development server after v1.5.14. The implementation adds support for tracking and sending warnings in the same way errors are handled, restoring the behavior similar to Create React App where TypeScript issues can be downgraded from errors to warnings during development.
Key Changes:
- Added a new
sendWarningmethod toSocketServerfor sending warnings to the client - Extended the async TypeScript issue handling to track and process warnings alongside errors
- Updated comments to reflect the dual handling of errors and warnings
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/server/socketServer.ts | Adds sendWarning public method to send warning messages to connected clients |
| packages/core/src/server/assets-middleware/index.ts | Extends async TypeScript issue detection to track warnings count, filter TS warnings, and send them to the client when no errors are present |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@chenjiahan, thank you for your rstackjs/ts-checker-rspack-plugin#53 |
|
Thank you! It is a simple feature, but I am happy to hear it makes things easier. |

Summary
While migrating a project from CRA to Rsbuild, I noticed an unexpected change that didn't occur six months ago. Create React App uses
ForkTsCheckerWarningWebpackPluginto adjust the severity of issues during development, changing them fromerrortowarning. This is helpful because it prevents the error overlay from appearing in development. Previously, this behavior worked as expected until the release https://github.com/web-infra-dev/rsbuild/releases/tag/v1.5.14. After that update, warnings still show in the terminal but are no longer sent to the browser's development server.I tried to fix it, but I'm not sure if it's the best approach. Code deduplication can be achieved. However, after https://github.com/web-infra-dev/rsbuild/releases/tag/v1.5.14, the behavior might not be as expected, since it no longer displays warnings as it did before.
I also noticed that warnings sometimes show up in the browser console, but this happens unpredictably and for reasons that aren't clear.
v1.6.10 w/o fix:
v1.6.10 w/ fix:
Related Links
https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/ForkTsCheckerWarningWebpackPlugin.js
Checklist