Skip to content

fix(core): ignore optional hono type imports - #13883

Merged
chenjiahan merged 2 commits into
mainfrom
chenjiahan/fix-hono-prebundle-types
Apr 30, 2026
Merged

chenjiahan merged 2 commits into
mainfrom
chenjiahan/fix-hono-prebundle-types

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Apr 30, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR fixes TypeScript TS2307 errors from the bundled http-proxy-middleware type declarations in @rspack/core. The generated compiled/http-proxy-middleware/index.d.ts can import optional Hono peer types from @hono/node-server and hono, causing projects without those packages installed to fail with missing-module errors such as:

Cannot find module `@hono/node-server` or its corresponding type declarations.
Cannot find module `hono` or its corresponding type declarations.

The prebundle step now suppresses those optional Hono peer type imports in the generated declaration file. This PR also adds tests/type-tests to run tsc --noEmit against the public @rspack/core and @rspack/cli type entries under both bundler and NodeNext module resolution, and wires it into test:ci.

Checklist

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

Copilot AI review requested due to automatic review settings April 30, 2026 01:43
@chenjiahan
chenjiahan requested a review from hardfist as a code owner April 30, 2026 01:43
@github-actions github-actions Bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Apr 30, 2026
@chenjiahan
chenjiahan requested a review from Timeless0911 April 30, 2026 01:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the @rspack/core prebundle pipeline to prevent TypeScript TS2307 “Cannot find module …” errors caused by optional Hono peer type imports appearing in the generated http-proxy-middleware declaration bundle.

Changes:

  • Adds an afterBundle post-processing step for http-proxy-middleware to suppress TS errors for optional imports from @hono/node-server and hono by injecting // @ts-ignore in the generated index.d.ts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/rspack/prebundle.config.js
@github-actions

github-actions Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 83f3d29 to feat(rslib): support emit isolated declarations (#13872) by Timeless0911

🙈 Size remains the same at 61.85MB

@github-actions

github-actions Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 6 projects in monorepo, 6 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB -
react-10k 5.7 MB -
react-1k 826.1 KB -
rome 1.6 MB -
react-5k 2.7 MB -
ui-components 4.8 MB -
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.7 MB - -
📄 JavaScript 1.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.7 MB - -
📄 JavaScript 5.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 826.1 KB - -
📄 JavaScript 826.1 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.6 MB - -
📄 JavaScript 1.6 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 4.8 MB - -
📄 JavaScript 4.7 MB - -
🎨 CSS 106.8 KB - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@codspeed

codspeed Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 34 untouched benchmarks


Comparing chenjiahan/fix-hono-prebundle-types (83f3d29) with main (9f97557)

Open in CodSpeed

@chenjiahan
chenjiahan enabled auto-merge (squash) April 30, 2026 02:08
@chenjiahan
chenjiahan merged commit 16a95cd into main Apr 30, 2026
36 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/fix-hono-prebundle-types branch April 30, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants