Skip to content

Comments

chore(build): bundle http-proxy-middleware instead of using prebundle#7125

Merged
chenjiahan merged 1 commit intomainfrom
bundle_proxy_middleware_0203
Feb 3, 2026
Merged

chore(build): bundle http-proxy-middleware instead of using prebundle#7125
chenjiahan merged 1 commit intomainfrom
bundle_proxy_middleware_0203

Conversation

@chenjiahan
Copy link
Member

Summary

Bundle http-proxy-middleware instead of using the prebundle. This reduces redundant code in the build output.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings February 3, 2026 03:52
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 http-proxy-middleware dependency is integrated into the build process. By transitioning from a static prebundle approach to dynamic imports, the system aims to reduce redundant code in the final build output and potentially improve loading performance. This change necessitates making the proxy middleware creation asynchronous and includes updates to dependency configurations, particularly for supports-color, to ensure proper resolution within the new bundling strategy.

Highlights

  • Dynamic Import for http-proxy-middleware: The http-proxy-middleware package is now dynamically imported using await import() instead of being prebundled. This allows it to be loaded as a separate chunk, optimizing build output.
  • Prebundle Configuration Update: The prebundle.config.ts for http-proxy-middleware has been updated to set dtsOnly: true, meaning only declaration files are prebundled, aligning with the new dynamic import strategy.
  • Asynchronous Proxy Middleware Creation: The createProxyMiddleware function has been made asynchronous to accommodate the dynamic import, requiring await calls where it is used.
  • Dependency Resolution for supports-color: The supports-color dependency has been explicitly added and its resolution updated across various packages in the pnpm-lock.yaml, ensuring consistent dependency management.
Changelog
  • packages/core/package.json
    • Added supports-color as a new dependency.
  • packages/core/prebundle.config.ts
    • Modified http-proxy-middleware configuration to dtsOnly: true.
  • packages/core/src/helpers/vendors.ts
    • Removed http-proxy-middleware from the CompiledPackages type definition.
  • packages/core/src/restart.ts
    • Normalized import path for chokidar.
  • packages/core/src/server/devMiddlewares.ts
    • Updated the call to createProxyMiddleware to use await.
  • packages/core/src/server/prodServer.ts
    • Updated the call to createProxyMiddleware to use await.
  • packages/core/src/server/proxy.ts
    • Removed requireCompiledPackage import.
    • Changed createProxyMiddleware to an async function.
    • Implemented dynamic import() for http-proxy-middleware with a webpack chunk name.
  • packages/core/src/server/watchFiles.ts
    • Normalized import path for chokidar.
  • packages/core/src/types/config.ts
    • Normalized import paths for chokidar and http-proxy-middleware.
  • packages/core/src/types/thirdParty.ts
    • Normalized import path for html-rspack-plugin.
  • pnpm-lock.yaml
    • Added [email protected] as a direct dependency.
    • Updated dependency resolution strings for connect, http-proxy-middleware, debug, follow-redirects, log4js, micromark, socket.io-adapter, socket.io-parser, streamroller, and stylus to reflect the inclusion of [email protected].
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-middleware at runtime via an async dynamic import and mark its prebundle entry as dtsOnly, 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 remove http-proxy-middleware from the requireCompiledPackage vendor map.
  • Add supports-color@^10.2.2 and adjust the lockfile so debug and related packages resolve with supports-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.

@chenjiahan chenjiahan merged commit d946d6e into main Feb 3, 2026
12 checks passed
@chenjiahan chenjiahan deleted the bundle_proxy_middleware_0203 branch February 3, 2026 03:59
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chenjiahan chenjiahan mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant