Remove @tanstack/vite-config patch after fixing upstream (vite-plugin-dts 5 / vite 8) #975
Follow-up from #949 (toolchain migration to oxc + TypeScript 7 + vite 8).
To build the library packages under vite 8 + vite-plugin-dts 5.x, #949 carries a local pnpm patch of @tanstack/vite-config@0.5.2:
patches/@tanstack__vite-config@0.5.2.patch
dts({ outDir })→dts({ outDirs })— vite-plugin-dts 5.x renamed the option; the 4.xoutDiris silently ignored.- adds
rollupOptions: { output: { preserveModules: true } }alongsiderolldownOptionsso module preservation holds under vite 8's rollup path.
0.5.2 is the latest published @tanstack/vite-config, so there is no upstream release to bump to. The patch is a stopgap.
Task#
- Open a PR against
TanStack/configmaking@tanstack/vite-configcompatible with vite-plugin-dts 5.x / vite 8 (the two changes above, guarded appropriately for the dts version it ships). - Once released, bump
@tanstack/vite-confighere and delete the patch:- remove
patches/@tanstack__vite-config@0.5.2.patch - remove the
patchedDependenciesentry inpnpm-workspace.yaml - re-run
pnpm installand the build to confirm parity.
- remove
Raised by @tombeckenham in review of #949 ("I don't love the patch to the tanstack config... Can we fix upstream?").
Verified via pkg.pr.new — the swap is not a clean drop-in#
Tested locally by pointing
@tanstack/vite-configat the PR-403 preview (https://pkg.pr.new/@tanstack/vite-config@403) and removing the patch. Two findings:The mechanism works — pnpm installs the preview and the patch is no longer needed for the
outDirs/rollupOptionsreasons it was created.But config
mainhas diverged from published0.5.2beyond the three patched lines (notably tsconfig-paths handling → vite 8 nativeresolve.tsconfigPaths). Under that config, declaration generation type-checks more strictly and fails on a pre-existing implicit-any in our own code:packages/ai-durable-stream/src/durable-stream.ts:607:36 error TS7006: Parameter 'signal' implicitly has an 'any' type. read: async function* (offset, signal) {The
StreamDurabilitytype declaresread: (offset: TOffset, signal?: AbortSignal) => …, but thedurableStreamfactory's returned object isn't annotated with that type, sosignalisn't contextually typed. The patched0.5.2build doesn't catch this; the released config will.
So the migration step here needs, in order:
- Land + release TanStack/config#403.
- Annotate the
durableStreamreturn object (or thereadparams) sosignalis typed — fixes the TS7006. - Bump
@tanstack/vite-configto the released version, delete the patch +patchedDependenciesentry,pnpm install, build.
Not committing the preview URL to #949 — pkg.pr.new builds are ephemeral and shouldn't land on
main; #949 keeps the patch until the real release.Update: per maintainer direction, #949 now consumes the fixed config directly via pkg.pr.new rather than waiting for a release. Commit
d3c053a16:@tanstack/vite-config→https://pkg.pr.new/@tanstack/vite-config@18aefa8(TanStack/config#403 head, SHA-pinned + integrity-locked in the lockfile)- deleted
patches/@tanstack__vite-config@0.5.2.patch+ itspatchedDependenciesentry - dropped the
vite-plugin-dts: 5.0.3override (the fixed config pins dts 5 itself) - typed
durableStream'sread(signal?: AbortSignal)(the latent implicit-any)
Verified locally:
build+test:build(publint --strict) across 48 projects,test:types,test:dts, sherif, knip all green.Remaining for this issue: once TanStack/config#403 merges and
@tanstack/vite-configis released, swap the pkg.pr.new URL for the real semver version (pkg.pr.new builds are ephemeral and shouldn't live onmainlong-term).Done — TanStack/config#403 merged and shipped in @tanstack/vite-config@0.6.0. Commit
54e5d316cswaps the pkg.pr.new preview for the real release.Final state on #949:
@tanstack/vite-config:0.6.0(npm)- patch +
patchedDependenciesentry: gone vite-plugin-dtsoverride: gone (0.6.0 pins dts 5 itself)durableStreamread(signal?: AbortSignal)typed
Verified:
build+test:build(publint --strict) across 48 packages, sherif, knip — all green.Minor lingering cleanup (not blocking): 0.6.0 is in
minimumReleaseAgeExcludebecause it was published <24h ago; once it ages past the 24hminimumReleaseAgewindow, that exclude entry can be dropped. Closing as the patch/override removal is complete.AlemTuzlak closed this
Sign in to join this conversation.
Upstream fix opened: TanStack/config#403 — bumps
vite-plugin-dtsto 5.0.3, renamesoutDir→outDirs, and setspreserveModulesunder bothrolldownOptionsandrollupOptions(exactly what the local patch does).Once that lands and
@tanstack/vite-configis released, step 2 here is: bump the dep, deletepatches/@tanstack__vite-config@0.5.2.patch, remove thepatchedDependenciesentry,pnpm install, and confirm the build.