fix(vite-config): support vite-plugin-dts 5 and Vite 8 Rollup path #403
Merged
AlemTuzlakmerged 4 commits into
main fromrefs/pull/403/head·merged by lachlancollins 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-dts4.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 theoutDiroption tooutDirs.preserveModulesis only set underrolldownOptions. Vite 8 bundles with Rolldown and reads that (in Vite 8rollupOptionsis a deprecated alias for it), but a consumer building with Vite 7 uses Rollup and readsbuild.rollupOptions, wherepreserveModuleswas 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-dts4.2.3→5.0.3(catalog). dts({ outDir })→dts({ outDirs })for both the ESM and CJS declaration passes (5.x option name).- Emit
preserveModulesunder bothbuild.rolldownOptionsandbuild.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.ctssnapshots 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-dtsoverride removed —build+test:build(publint --strict) pass across 48 packages.
Changeset included (minor).
Summary by CodeRabbit#
- New Features
- Improved compatibility with
vite-plugin-dtsv5 and Vite 8 build output behavior.
- Improved compatibility with
- Bug Fixes
- Ensured module preservation works consistently across both standard Rollup and rolldown-style build outputs.
- Dependency Updates
- Bumped
vite-plugin-dtsto5.0.3. - Added
@vue/language-coreto the Vue integration.
- Bumped
- Documentation / Generated Types
- Updated Vue TypeScript declaration snapshots to use clearer intermediate export/props typing.
- 1
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
Diff Package Supply Chain
SecurityVulnerability Quality Maintenance License vite-plugin-dts@5.0.3 @vue/language-core@3.3.7 View your CI Pipeline Execution ↗ for commit 65c911ee36380a1369f12ee6fc0b01a43c70555a
Command Status Duration Result nx affected --targets=test:sherif,test:docs,tes...✅ Succeeded 14s View ↗ nx run-many --target=build✅ Succeeded 6s View ↗
☁️ Nx Cloud last updated this comment at
2026-07-21 11:18:07UTCnpm i https://pkg.pr.new/@tanstack/eslint-config@403npm i https://pkg.pr.new/@tanstack/publish-config@403npm i https://pkg.pr.new/@tanstack/typedoc-config@403npm i https://pkg.pr.new/@tanstack/vite-config@403commit:
65c911elachlancollins merged thisebbe489
lachlancollins closed this
Sign in to join this conversation.
📝 Walkthrough
Walkthrough#
Updates
vite-plugin-dtsto 5.0.3, changes declaration output configuration tooutDirs, enables module preservation for Rollup and rolldown outputs, and refreshes Vue declaration snapshots.Changes#
vite-plugin-dts 5 and Vite 8 compatibility
.changeset/vite-plugin-dts-5-vite8.md,packages/vite-config/src/index.ts,pnpm-workspace.yamlvite-plugin-dtsto 5.0.3, usesoutDirsfor ESM and CJS declarations, and setspreserveModulesfor both Rollup and rolldown outputs.integrations/vue/package.json,integrations/vue/snap/{cjs,esm}/...@vue/language-coreand updates generated Vue declarations to use named component and props types.Estimated code review effort: 2 (Simple) | ~10 minutes
Possibly related issues
vite-plugin-dts5 and Vite 8.Suggested labels:
dependencies🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
✨ Finishing Touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
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