mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #539] [MERGED] fix: merge top-level optimizeDeps with per-environment config #658
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#658
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/539
Author: @Jbithell
Created: 3/14/2026
Status: ✅ Merged
Merged: 3/16/2026
Merged by: @james-elicx
Base:
main← Head:fix-optimizedeps-merging📝 Commits (8)
405669efix: merge top-level optimizeDeps with per-environment configd2de05ffix: merge top-level optimizeDeps with per-environment config03df101docs: add PR description for optimizeDeps merge fixfce927bchore: remove pr-description.mde9e7471fix: merge optimizeDeps for Pages Router + improve test coverage466a8adMerge pull request #1 from Jbithell/claude/fix-optimizedeps-merging-jBbMWf16102efix: preserve optimizeDeps.include for Pages Router + fix formattingb37f89dMerge pull request #2 from Jbithell/claude/fix-optimizedeps-merging-jBbMW📊 Changes
2 files changed (+115 additions, -18 deletions)
View changed files
📝
packages/vinext/src/index.ts(+33 -17)📝
tests/build-optimization.test.ts(+82 -1)📄 Description
Summary
Fixes #538
vinext's
config()hook was creating per-environmentoptimizeDepsobjects from scratch, discarding anyexcludeorincludeentries that other Vite plugins (e.g.@lingui/vite-plugin) had added to the top-levelconfig.optimizeDepsduring their ownconfighooks.This PR captures the incoming
config.optimizeDeps.excludeandconfig.optimizeDeps.includearrays before building the per-environment configs, then merges them (with deduplication viaSet) into each environment:excludenow includes incoming excludes +["vinext", "@vercel/og"]excludenow includes incoming excludes +["vinext", "@vercel/og"]excludenow includes incoming excludes +["vinext", "@vercel/og", ...serverExternalPackages];includenow includes incoming includes + React packagesChanges
packages/vinext/src/index.ts— Readconfig.optimizeDeps?.excludeandconfig.optimizeDeps?.includeat the top of the environments block, then spread them into each environment'soptimizeDepsusing[...new Set([...incoming, ...vinextOwn])]tests/build-optimization.test.ts— New test that passesoptimizeDeps.excludeandoptimizeDeps.includevia the mock config (simulating an earlier plugin like@lingui/vite-plugin) and verifies those entries appear in all three environments alongside vinext's own entriesTest plan
optimizeDeps.exclude(@lingui/macro,@lingui/core/macro) andoptimizeDeps.include(some-lib) via mock config, verifies they appear in rsc/ssr/client environments alongside vinext's own entriesoptimizeDeps.excludetests still pass (66/66 inbuild-optimization.test.ts)pnpm run fmt:check— passespnpm run lint— 0 warnings, 0 errorspnpm run typecheck— passes🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.