Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proxy type error #3936

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/core/prebundle.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ export default {
)}`,
);
},
afterBundle(task) {
replaceFileContent(
join(task.distPath, 'index.d.ts'),
(content) =>
// TODO: Due to the breaking change of http-proxy-middleware, it needs to be upgraded in rsbuild 2.0
// https://github.com/chimurai/http-proxy-middleware/pull/730
`${content
.replace('express.Request', 'http.IncomingMessage')
.replace('express.Response', 'http.ServerResponse')
.replace(
'extends express.RequestHandler {',
`{
(req: Request, res: Response, next?: (err?: any) => void): void | Promise<void>;`,
)}`,
);
},
},
{
// The webpack-bundle-analyzer version was locked to v4.9.0 to be compatible with Rspack
Expand Down
Loading