Closed chirastefan closed 1 year ago
This plugin only affects Vite module resolution, which isn't responsible for type declaration file generation. This is actually a "bug" with TypeScript itself (see https://github.com/microsoft/TypeScript/issues/25677).
Meanwhile, I tried using aliases directly into vite.config.ts
(without vite-tsconfig-paths
) and it works, the aliases are transformed inside the generated .d.ts files. So I think this is an issue with vite-tsconfig-paths
.
@chirastefan The resolve.alias
option actually rewrites the code before vite-plugin-dts
processes it. This plugin merely interprets the import as it's written and tells Vite which module the import is referring to.
I'm using
vite-tsconfig-paths
for resolving aliases from thetsconfig.json
file andvite-plugin-dts
for generating .d.ts files and they work fine inside my project, but after I run build (in lib mode) and check the dist folder the imports aliases are not resolved. They point to the src folder, not the dist folder. Adding a relative path works though. Shouldn't the aliases be resolved on build?Reproduction https://stackblitz.com/edit/vitejs-vite-b6n9u5?file=package.json
Steps to reproduce run npm install then npm run build