I'm trying to bundle types alongside my Vite library, using vite-plugin-dts
.
When I try to build with rollupTypes: true
option inside vite.config.json
, I get the following error:
Analysis will use the bundled TypeScript version 5.0.4
*** The target project appears to use TypeScript 5.2.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
[vite:dts] Internal Error: Unable to determine semantic information for declaration ...
By trial and error, I found I can fix this problem by setting emitDeclarationOnly: true
, in tsconfig.json
, after which the build step finishes without problems, with main.d.ts
appropriately bundled, however, it also leads to .d.ts
files getting emitted into my src
folder.
I would prefer to not have .d.ts
files polluting my src
and instead just bundle types during the build step. Is there any way to do this?