Skip to content

fix(dev): keep server-resolved packages out of every dep optimizer - #3235

Open
JamesbbBriz wants to merge 1 commit into
cloudflare:mainfrom
JamesbbBriz:fix/known-interop-optimizer-excludes
Open

fix(dev): keep server-resolved packages out of every dep optimizer#3235
JamesbbBriz wants to merge 1 commit into
cloudflare:mainfrom
JamesbbBriz:fix/known-interop-optimizer-excludes

Conversation

@JamesbbBriz

@JamesbbBriz JamesbbBriz commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Two gaps let node-shaped packages break the dev server when reached through server code:

  • file-type ships a dual CJS/ESM package. When any optimizer pre-bundles it (Payload reaches it through payload/dist/uploads), Rolldown resolves the core entry and loses the named exports — MISSING_EXPORT on fileTypeFromFile and friends, and the dev server dies. The runtime resolvers load it fine, so it now joins the shared exclude list.
  • Server-external packages were excluded from the client optimizer but not from the rsc/ssr optimizers, even though the server environments already load them through the runtime resolver. Their node-only conditional exports resolve to the wrong entry inside the optimizer pipeline, so the rsc and ssr excludes now mirror the client one.

Regression coverage asserts all three optimizers exclude both the server-external entries and file-type.

Fixes #3236

Two gaps let node-shaped packages break the dev server when they were
reached through server code:

- file-type ships a dual CJS/ESM package. When any optimizer pre-bundles
  it (Payload reaches it through payload/dist/uploads), Rolldown resolves
  the core entry and loses the named exports — MISSING_EXPORT on
  fileTypeFromFile and friends, and the dev server dies. The runtime
  resolvers load it fine, so it now joins the shared exclude list.
- server-external packages were excluded from the client optimizer but
  not from the rsc/ssr optimizers, even though the server environments
  already load them through the runtime resolver. Their node-only
  conditional exports resolve to the wrong entry inside the optimizer
  pipeline, so the rsc and ssr excludes now mirror the client one.

The app-router dev-server regression surface is covered by asserting all
three optimizers exclude both the server-external entries and file-type.
@chatgpt-codex-connector

Copy link
Copy Markdown

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, add credits to your account and enable them for code reviews in your settings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@3235
npm i https://pkg.pr.new/create-vinext-app@3235
npm i https://pkg.pr.new/@vinext/types@3235
npm i https://pkg.pr.new/vinext@3235

commit: 2466a3a

@github-actions

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 2466a3a against base 13e7d9c using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.4 KB 142.4 KB ⚫ 0.0%
Client entry size (gzip) vinext 129.7 KB 129.7 KB ⚫ 0.0%
Dev server cold start vinext 3.26 s 3.25 s ⚫ -0.6%
Production build time vinext 3.41 s 3.44 s ⚫ +0.7%
RSC entry closure size (gzip) vinext 125.5 KB 125.4 KB ⚫ -0.0%
Server bundle size (gzip) vinext 216.1 KB 216.1 KB ⚫ -0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

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.

Dev server dies with MISSING_EXPORT when server code pulls in file-type; serverExternalPackages not honored by rsc/ssr dep optimizers

1 participant