Skip to content
Source
Sign inSign up
TanStack/ai

Remove @tanstack/vite-config patch after fixing upstream (vite-plugin-dts 5 / vite 8) #975

ClosedAlemTuzlak opened this issue 4 comments
AlemTuzlakcommented

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.x outDir is silently ignored.
  • adds rollupOptions: { output: { preserveModules: true } } alongside rolldownOptions so 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

  1. Open a PR against TanStack/config making @tanstack/vite-config compatible with vite-plugin-dts 5.x / vite 8 (the two changes above, guarded appropriately for the dts version it ships).
  2. Once released, bump @tanstack/vite-config here and delete the patch:
    • remove patches/@tanstack__vite-config@0.5.2.patch
    • remove the patchedDependencies entry in pnpm-workspace.yaml
    • re-run pnpm install and the build to confirm parity.

Raised by @tombeckenham in review of #949 ("I don't love the patch to the tanstack config... Can we fix upstream?").

  1. Upstream fix opened: TanStack/config#403 — bumps vite-plugin-dts to 5.0.3, renames outDir→outDirs, and sets preserveModules under both rolldownOptions and rollupOptions (exactly what the local patch does).

    Once that lands and @tanstack/vite-config is released, step 2 here is: bump the dep, delete patches/@tanstack__vite-config@0.5.2.patch, remove the patchedDependencies entry, pnpm install, and confirm the build.

  2. Verified via pkg.pr.new — the swap is not a clean drop-in

    Tested locally by pointing @tanstack/vite-config at the PR-403 preview (https://pkg.pr.new/@tanstack/vite-config@403) and removing the patch. Two findings:

    1. The mechanism works — pnpm installs the preview and the patch is no longer needed for the outDirs/rollupOptions reasons it was created.

    2. But config main has diverged from published 0.5.2 beyond the three patched lines (notably tsconfig-paths handling → vite 8 native resolve.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 StreamDurability type declares read: (offset: TOffset, signal?: AbortSignal) => …, but the durableStream factory's returned object isn't annotated with that type, so signal isn't contextually typed. The patched 0.5.2 build doesn't catch this; the released config will.

    So the migration step here needs, in order:

    1. Land + release TanStack/config#403.
    2. Annotate the durableStream return object (or the read params) so signal is typed — fixes the TS7006.
    3. Bump @tanstack/vite-config to the released version, delete the patch + patchedDependencies entry, 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.

  3. 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 + its patchedDependencies entry
    • dropped the vite-plugin-dts: 5.0.3 override (the fixed config pins dts 5 itself)
    • typed durableStream's read(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-config is released, swap the pkg.pr.new URL for the real semver version (pkg.pr.new builds are ephemeral and shouldn't live on main long-term).

  4. Done — TanStack/config#403 merged and shipped in @tanstack/vite-config@0.6.0. Commit 54e5d316c swaps the pkg.pr.new preview for the real release.

    Final state on #949:

    • @tanstack/vite-config: 0.6.0 (npm)
    • patch + patchedDependencies entry: gone
    • vite-plugin-dts override: gone (0.6.0 pins dts 5 itself)
    • durableStream read(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 minimumReleaseAgeExclude because it was published <24h ago; once it ages past the 24h minimumReleaseAge window, that exclude entry can be dropped. Closing as the patch/override removal is complete.

  5. AlemTuzlak closed this

Sign in to join this conversation.