Repository navigation
fix(tanstack-start): keep database adapters out of the client dep optimizer - #18313
Merged
r1tsuu merged 1 commit intoSep 25, 2026
Merged
Conversation
…imizer
The client dep scan follows server functions' `import('@payload-config')`
without TanStack's server-fn stripping, so it reaches the database adapter
and pre-bundles the whole driver for the browser. Mongoose 9 has no browser
build, so that bundles `mongodb`; when its optional
`@aws-sdk/credential-providers` peer is linked (as in the monorepo, via
`@payloadcms/payload-cloud`), the browser build of
`credential-provider-web-identity` drops `fromTokenFile` and the dev server
crashes with a `MISSING_EXPORT` error before serving anything.
Exclude the adapter packages (reached by published installs) and the
`mongoose`/`mongodb` drivers (reached by the monorepo, which resolves the
adapters to source) from `optimizeDeps`.
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
jacobsfletch
approved these changes
Sep 25, 2026
r1tsuu
deleted the
fix/tanstack-exclude-db-adapters-from-client-optimizer
branch
September 25, 2026 13:20
Contributor
|
🚀 This is included in version v4.0.0-canary.38 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pnpm dev:tanstackin the monorepo crashes on boot with[MISSING_EXPORT] "fromTokenFile" is not exported by ".../@aws-sdk/credential-provider-web-identity/dist-es/index.js".Vite's client dep scan follows
import('@payload-config')in server functions, reaches the database adapter, and pre-bundles the driver for the browser. Mongoose 9 (#17747) has no browser build, so this now pulls inmongodband its optional@aws-sdk/credential-providerspeer, whose browser build doesn't exportfromTokenFile. Published installs don't crash, but they still bundle@payloadcms/db-mongodbinto a browser chunk nothing loads.This excludes the
@payloadcms/db-*adapters,@payloadcms/drizzle,mongooseandmongodbfrom the client optimizer, like the existing@azure/storage-blobexclusion.