Open Akiyamka opened 3 months ago
Temporary workaround: in case project uses pnpm you can add next settings in package.json
{
"pnpm": {
"packageExtensions": {
"vite-plugin-dts": {
"dependenciesMeta": {
"@volar/typescript": {
"optional": true
},
"vue-tsc": {
"optional": true
},
"@vue/language-core": {
"optional": true
}
}
}
}
}
}
Are you install the plugin to dependencies
but not devDependencies
? Dev dependencies will not be packed into the final chunk.
Those packages of Volar are the basic dependencies of the plugin, they are not optional.
Let me be clear. It's not about final chunk. Such build time deps, regardless of whether is installed in dependencies
or devDepenencies
, usually not included in a bundle because it's not imported in final application anywhere.
However, if the project does not use vue, these dependencies are simply not used, in other words they are optional and are only needed for a certain tech stack
What's wrong with unnecessary dependencies that will never be used in some projects? I would say it's not a critical problem, but such dependencies cause some inconvenience:
Thus, making these dependencies optional not only better reflects reality, but will make the users of this wonderful library a little happier ; )
I'd add to some downsides, these Vue dependencies that my project doesn't use caused dependency resolution conflicts because they specify a different version of vue-tsc
that some other package is unnecessarily including vue-tsc
as a dependency as well.
Describe the bug
In case it used in pure node.js app or for example in react app - it unnecessary adds such dependencies as
@vue/language-core
,@vue/compiler-core
,@vue/compiler-dom
, batch of@volar/**
packages and so on. Can be fixed by moving next packages to peerDependencies or optionalDependenciesReproduction
not related
Steps to reproduce
pnpm add vite-plugin-dts
System Info
Validations