chore(build): bundle http-proxy-middleware instead of using prebundle#7125
chore(build): bundle http-proxy-middleware instead of using prebundle#7125chenjiahan merged 1 commit intomainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors how the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR switches http-proxy-middleware from being prebundled as a compiled vendor to being bundled directly by Rspack, and wires up its optional supports-color dependency so that debug logging is correctly colored. It also cleans up several type-only imports to use directory paths instead of index.js, keeping them aligned with how prebundled typings are emitted.
Changes:
- Load
http-proxy-middlewareat runtime via an async dynamic import and mark its prebundle entry asdtsOnly, so only types are prebundled while the implementation is bundled normally. - Update all usages of
createProxyMiddleware(dev and prod servers) to await the now-async factory and removehttp-proxy-middlewarefrom therequireCompiledPackagevendor map. - Add
supports-color@^10.2.2and adjust the lockfile sodebugand related packages resolve withsupports-color, plus normalize various compiled import paths (chokidar,html-rspack-plugin) to folder-level imports.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates dependency graph to add [email protected] and wire it into debug, connect, http-proxy-middleware, and related packages. |
| packages/core/src/types/thirdParty.ts | Simplifies HtmlRspackPlugin type import to the compiled/html-rspack-plugin directory, matching other compiled vendor imports. |
| packages/core/src/types/config.ts | Points ChokidarOptions and HttpProxyOptions/ProxyFilter imports at their compiled package directories instead of index.js. |
| packages/core/src/server/watchFiles.ts | Updates FSWatcher type import from the compiled/chokidar directory while leaving runtime loading via dynamic import of chokidar intact. |
| packages/core/src/server/proxy.ts | Makes createProxyMiddleware async and switches from requireCompiledPackage('http-proxy-middleware') to an async dynamic import of http-proxy-middleware, while still using compiled typings. |
| packages/core/src/server/prodServer.ts | Awaits the now-async createProxyMiddleware when wiring proxies in the production server middleware pipeline. |
| packages/core/src/server/devMiddlewares.ts | Awaits the async createProxyMiddleware in the dev middleware setup and propagates the returned upgrade handler. |
| packages/core/src/restart.ts | Aligns ChokidarOptions type import to use the compiled/chokidar directory path. |
| packages/core/src/helpers/vendors.ts | Removes http-proxy-middleware from the compiled vendor map now that it is no longer prebundled as a runtime dependency. |
| packages/core/prebundle.config.ts | Marks http-proxy-middleware as dtsOnly: true while keeping the existing type-patching beforeBundle hook, so only typings are prebundled. |
| packages/core/package.json | Adds supports-color@^10.2.2 to devDependencies to satisfy the debug/http-proxy-middleware dependency chain during bundling. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request refactors how http-proxy-middleware is handled, moving from pre-bundling to direct bundling via a dynamic import. This is a good change that should help reduce redundant code in the build output. The necessary changes to make the proxy creation asynchronous have been correctly propagated through the codebase. The pull request also includes some nice cleanups to import paths, making them more consistent. Overall, the changes are well-executed and improve the project's build strategy.
Summary
Bundle
http-proxy-middlewareinstead of using theprebundle. This reduces redundant code in the build output.Checklist