Skip to content
Source
Sign inSign up
TanStack/config

fix(vite-config): support vite-plugin-dts 5 and Vite 8 Rollup path #403

MergedAlemTuzlakmerged 4 commits intomain fromrefs/pull/403/headmerged by lachlancollins

AlemTuzlakcommented

Problem

@tanstack/vite-config pins vite-plugin-dts@4.2.3 and only sets build.rolldownOptions. Projects migrating to the new toolchain (TypeScript 7 / tsgo + Vite 8) can't use it as-is:

  • vite-plugin-dts 4.x reads the pre-7 TS JS Compiler API and crashes under TS7; the fix is 5.x, which adds tsgo/TS7 support but renames the outDir option to outDirs.
  • preserveModules is only set under rolldownOptions. Vite 8 bundles with Rolldown and reads that (in Vite 8 rollupOptions is a deprecated alias for it), but a consumer building with Vite 7 uses Rollup and reads build.rollupOptions, where preserveModules was being dropped. Setting both keeps module preservation working on Vite 7 and Vite 8.

TanStack AI currently works around both with a local pnpm patch of @tanstack/vite-config@0.5.2 (see TanStack/ai#975). This PR fixes it upstream so the patch can go away.

Changes

  • Bump bundled vite-plugin-dts 4.2.3 → 5.0.3 (catalog).
  • dts({ outDir }) → dts({ outDirs }) for both the ESM and CJS declaration passes (5.x option name).
  • Emit preserveModules under both build.rolldownOptions and build.rollupOptions, so module preservation holds whether the consumer builds with Vite 8 (Rolldown) or Vite 7 (Rollup).
  • Add @vue/language-core (dts 5's optional Vue peer) to the catalog + vue integration, and refresh the vue .d.ts/.d.cts snapshots for vue-language-core 3's output.

Verification

  • Full CI target set green locally: sherif, build (6 projects), test:build (4), test:types (4), test:eslint (4), test:docs.
  • End-to-end validated downstream: TanStack AI consumes this via pkg.pr.new with the local patch + vite-plugin-dts override removed — build + test:build (publint --strict) pass across 48 packages.

Changeset included (minor).

Summary by CodeRabbit

  • New Features
    • Improved compatibility with vite-plugin-dts v5 and Vite 8 build output behavior.
  • Bug Fixes
    • Ensured module preservation works consistently across both standard Rollup and rolldown-style build outputs.
  • Dependency Updates
    • Bumped vite-plugin-dts to 5.0.3.
    • Added @vue/language-core to the Vue integration.
  • Documentation / Generated Types
    • Updated Vue TypeScript declaration snapshots to use clearer intermediate export/props typing.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Review Change Stack

      📝 Walkthrough

      Walkthrough

      Updates vite-plugin-dts to 5.0.3, changes declaration output configuration to outDirs, enables module preservation for Rollup and rolldown outputs, and refreshes Vue declaration snapshots.

      Changes

      vite-plugin-dts 5 and Vite 8 compatibility

      Layer / File(s)Summary
      Declaration and module preservation configuration
      .changeset/vite-plugin-dts-5-vite8.md, packages/vite-config/src/index.ts, pnpm-workspace.yaml
      Updates vite-plugin-dts to 5.0.3, uses outDirs for ESM and CJS declarations, and sets preserveModules for both Rollup and rolldown outputs.
      Vue declaration tooling
      integrations/vue/package.json, integrations/vue/snap/{cjs,esm}/...
      Adds @vue/language-core and updates generated Vue declarations to use named component and props types.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Possibly related issues

      • TanStack/ai issue 975 — Implements the upstream fixes for vite-plugin-dts 5 and Vite 8.

      Suggested labels: dependencies

      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Title check✅ PassedThe title accurately summarizes the main change: vite-config now supports vite-plugin-dts 5 and the Vite 8 Rollup path.
      Description check✅ PassedIt covers the problem, changes, and verification, and is substantially aligned with the template despite missing the exact checklist/release-impact sections.
      ✨ Finishing Touches
      📝 Generate docstrings
      • Create stacked PR
      • Commit on current branch
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `fix/vite-plugin-dts-5-vite8`

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. socket-security[bot](GitHub profile, opens in a new tab)commented

      Review the following changes in direct dependencies. Learn more about Socket for GitHub.

      Diff Package Supply Chain
      Security
      Vulnerability Quality Maintenance License
      Addedvite-plugin-dts@​5.0.31001008692100
      Added@​vue/​language-core@​3.3.710010010097100

      View full report

    3. github-actions[bot](GitHub profile, opens in a new tab)commented

      🚀 Changeset Version Preview

      1 package(s) bumped directly, 0 bumped as dependents.

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/vite-config0.5.2 → 0.6.0Changeset
    4. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 65c911ee36380a1369f12ee6fc0b01a43c70555a

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:docs,tes...✅ Succeeded14sView ↗
      nx run-many --target=build✅ Succeeded6sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-07-21 11:18:07 UTC

    5. pkg-pr-new[bot](GitHub profile, opens in a new tab)commented
      npm i https://pkg.pr.new/@tanstack/eslint-config@403
      npm i https://pkg.pr.new/@tanstack/publish-config@403
      npm i https://pkg.pr.new/@tanstack/typedoc-config@403
      npm i https://pkg.pr.new/@tanstack/vite-config@403

      commit: 65c911e

    6. lachlancollins merged thisebbe489

    7. lachlancollins closed this

Sign in to join this conversation.