-
Notifications
You must be signed in to change notification settings - Fork 106
References are ignored #459
Copy link
Copy link
Open
Description
Describe the bug
I have a custom tsconfig.build.json that I use in the tsconfigPath when configuring dts. However, it appears the references in my tsconfig file are just dropped. One of the references has an invalid path, which tsc complains about, but dts does not. It also does not generate any types whatsoever. If I switch to a different tsconfig file that uses includes instead, it does work.
vite.config.build.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dts from "vite-plugin-dts"
const UseReferences = true;
// https://vite.dev/config/
export default defineConfig({
plugins: [vue(), dts({
tsconfigPath: UseReferences ? "tsconfig.build.json" : "tsconfig.json"
})],
build: {
emptyOutDir: true,
lib: {
formats: ["es"],
entry: {
main: "src/main.ts"
}
}
}
})tsconfig.build.json
{
"files": [],
"references": [{
"path": "this/does/not/exist.json"
}, {
"path": "src/tsconfig.build.json"
}]
}src/tsconfig.build.json
{
"compilerOptions": {
"target": "esnext",
"composite": true,
"rootDir": ".",
"baseUrl": "."
}
}tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"composite": true,
"rootDir": "src",
"baseUrl": "."
},
"include": [
"src/**/*.ts"
]
}Reproduction
https://github.com/incutonez/issues/blob/main/vite%20dts%20plugin%20references%20not%20working.7z
Steps to reproduce
- Download the zip file
npm inpm run build- Notice that only a main.js file is in the dist dir
- Open vite.config.build.ts and change the
UseReferencesbool to false npm run build- Notice that there's now a main.d.ts file
System Info
Windows 11
Node: 22.21.1
npm: 10.9.4
@vitejs/plugin-vue: ^6.0.2 => 6.0.4
vite: ^7.2.7 => 7.3.1
vite-plugin-dts: ~4.5.4 => 4.5.4Validations
- Read the FAQ.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels