You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In it's current version, vite-plugin-dts is not generating any type defintiion files, when ${configDir} is used in the include property of tsconfig.json files.
Description
As a developer using vite-plugin-dts I want to be able to use the
${configDir}
template variable in tsconfig.json (added in typescript 5.5 - https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#the-configdir-template-variable-for-configuration-files ), specially when using a shared tsconfig in monorepo.In it's current version, vite-plugin-dts is not generating any type defintiion files, when ${configDir} is used in the
include
property oftsconfig.json
files.The repo @ https://github.com/chandu/vite-dts-config-dir-test demonstrates the issue.
Clone the repo and then issue the following commands:
pnpm i
pnpm run build
// Prints Dts File Exists: truepnpm run build-config-dir
// Prints Dts File Exists: false, this script is running the build using the tsconfig that has the ${configDir} referenceSuggested solution
The issue happens to be because the newly introduced
configDir
template variable nuances are not used/leveared by the@vue/language-core
package.Where the configFileSpecs is assigned: https://github.com/microsoft/TypeScript/blob/main/src/compiler/commandLineParser.ts#L2945
Where the updated configFileSpecs is not leveraged:
https://github.com/vuejs/language-tools/blob/7d44d8e844ef4f51407e57ce39e5570c9c9b6ece/packages/language-core/lib/utils/ts.ts#L84
Where the
createParsedCommandLine
function of@vue/language-core
is called:https://github.com/qmhc/vite-plugin-dts/blob/main/src/plugin.ts#L261
I am not sure what is the right fix/solution.
One possible way is to modify the
@vue/language-core
to also return 'configFileSpecs' populated on theconfig
object at https://github.com/vuejs/language-tools/blob/7d44d8e844ef4f51407e57ce39e5570c9c9b6ece/packages/language-core/lib/utils/ts.ts#L84 and the propagate that to thevite-plugin-dts
where the include/exclude could be rightly used when calling thecreateFilter
, ut would span updating more than one package.or
use the tsconfig file/content to parse the file, get the
configFileSpecs
and use thevalidatedIncludeSpecs
andvalidatedExcludeSpecs
to create the filter at https://github.com/qmhc/vite-plugin-dts/blob/main/src/plugin.ts#L323I am sure there could be better solutions, but this is what I could think of with limited insights into the typescript tsconfig parsing.
Alternative
For now, I am passing the resolved/hardcoded include/exlcude as the dts plugin options.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: