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
I have a project, where I have path aliases defined in tsconfig.json to simplify usage of any module within src folder:
"paths": {
"*": ["src/*"],
},
This setting allows to simplify the imports, so that instead of: import { Sample } from 'src/components/Sample'; (or even import { Sample } from '@/components/Sample';)
we can use: import { Sample } from 'components/Sample';
When I build the app, the app itself works fine (thanks to the vite-tsconfig-paths), but all the d.ts files for .ts files that are inside a subfolder of src, are generated with invalid import paths.
The original ts file:
The output d.ts file:
It was working fine in vite-plugin-dts@3.6.4. Any version since then (so starting from v3.7.0) has the issue.
Possibly there is an issue in this commit that was introduced in 3.7.0: e8827cb
Describe the bug
I have a project, where I have path aliases defined in
tsconfig.json
to simplify usage of any module within src folder:This setting allows to simplify the imports, so that instead of:
import { Sample } from 'src/components/Sample';
(or evenimport { Sample } from '@/components/Sample';
)we can use:
import { Sample } from 'components/Sample';
When I build the app, the app itself works fine (thanks to the
vite-tsconfig-paths
), but all thed.ts
files for.ts
files that are inside a subfolder of src, are generated with invalidimport
paths.The original ts file:
![image](https://private-user-images.githubusercontent.com/22868198/331167579-362bbab3-1221-4029-b968-b474eae99870.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4ODAyNjAsIm5iZiI6MTcxODg3OTk2MCwicGF0aCI6Ii8yMjg2ODE5OC8zMzExNjc1NzktMzYyYmJhYjMtMTIyMS00MDI5LWI5NjgtYjQ3NGVhZTk5ODcwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIwVDEwMzkyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYyYjRmZDExZjcwOWMzYmNkNWFmNmNhYjk3NGE3YWY4NWZiZmUxZTNmMWQxODQ3NGZmYTJhZmM4YjUzNzVkYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.BUW3ENRxvNUd7u8q95jghnZvQiSVoN3OPIUa5kW62SE)
![image](https://private-user-images.githubusercontent.com/22868198/331167675-6d686b3a-5899-47a4-9ad9-b036e0c97991.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4ODAyNjAsIm5iZiI6MTcxODg3OTk2MCwicGF0aCI6Ii8yMjg2ODE5OC8zMzExNjc2NzUtNmQ2ODZiM2EtNTg5OS00N2E0LTlhZDktYjAzNmUwYzk3OTkxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIwVDEwMzkyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNjZTcyZjdlMmNkYTEzZjU2YTEzMzIxZmFjYjBlNjlkZGIzYThkNTY5M2FkNGIyZGE1OTAxMDFkNThjODQzODkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rTiJZpCNgtCSWToNqNCrZZWTqPdxyRhtDoXIP5-17XM)
The output d.ts file:
It was working fine in
vite-plugin-dts@3.6.4
. Any version since then (so starting from v3.7.0) has the issue.Possibly there is an issue in this commit that was introduced in 3.7.0:
e8827cb
Reproduction
https://stackblitz.com/edit/vitejs-vite-sg53ed?file=dist%2Ftypes%2Fcomponents%2FSample%2Findex.d.ts
Steps to reproduce
src
, and there create any other folder containing some sample component:where
index.ts
is only reexporting the componentimport the component in App.tsx:
import { Sample } from 'components/Sample';
set the project's configuration:
package.json
vite related libraries:
tsconfig.json
add the following
"paths"
:vite.config.ts
vite build
commanddist/types
folder you will find d.ts files with invalid import pathsSystem Info
Validations
The text was updated successfully, but these errors were encountered: