fix(dev): keep server-resolved packages out of every dep optimizer - #3235
JamesbbBriz wants to merge 4 commits into
Conversation
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
@vinext/cloudflare
create-vinext-app
@vinext/types
vinext
@cloudflare/workers-response-store
commit: |
Performance benchmarksCompared 0 improved · 0 regressed · 6 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
|
/bigbonk review for issues Time limit: 8 minutes. Complete the review and post all findings within that limit. |
|
Posted 1 actionable inline review finding. Targeted tests pass. |
|
/bigbonk review for issues Time limit: 8 minutes. Complete the review and post all findings within that limit. |
|
LGTM! |
Two gaps let Node-oriented packages break the dev server when reached through server code:
file-typeuses conditional exports: its Node entry exposes APIs such asfileTypeFromFile, while its defaultcore.jsentry does not. When the dependency optimizer reaches it through packages such as Payload, Rolldown can selectcore.jsand fail withMISSING_EXPORT. Runtime resolution selects the correct entry, sofile-typeis now excluded from pre-bundling.serverExternalPackagesare runtime-resolved, but were not excluded consistently from dependency optimization. App Router RSC/SSR/client optimizers and Pages Router client/SSR/Cloudflare Worker optimizers now all preserve that invariant.Regression coverage checks both App and Pages Router optimizer configurations, including the Cloudflare Pages Router Worker environment. This follows Next.js's coverage of
serverExternalPackagesin both App and Pages Router applications.Validation:
vp test run tests/build-optimization.test.ts— 170 passed, 2 skippedvp check packages/vinext/src/index.ts packages/vinext/src/plugins/rsc-client-shim-excludes.ts tests/build-optimization.test.tsvp run vinext#buildFixes #3236