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 am using the absolute path in the source code through the path alias setting in tsconfig.json. And I enabled the declaration option in tsconfig.json.
When built using ts-loader and webpack, it builds normally and creates a .js file, but the path of the import statement in the .d.ts file is still displayed as an absolute path.
I wonder why the generated .d.ts path is not converted.
Expected Behaviour
The file path of the import statement in the .d.ts file must also be converted into a relative path.
Actual Behaviour
The import statements in the d.ts file are displayed the same as the source code (in absolute path).
I have confirmed that the handling of path conversion is done through webpack.resolve, so I will close this issue.
I'm share my findings below in the hopes that it will help someone.
ts-loader seems to deliver the JS converted using the TS compiler to the webpack loader context (I could check the path of the .d.ts file generated by the TS compiler through the webpack assets) .
The TS compiler does not handle path conversion and seems to be designed to only convert the code written in Typescript into Javascript code. (Please check the discussion link below.)
Therefore, it seems that the path conversion process of files created through other library modules such as webpack.resolve(bundling processing only), ts-alias, ttypescript, etc. should be done.
Hi
I am using the absolute path in the source code through the
path alias
setting in tsconfig.json. And I enabled thedeclaration
option in tsconfig.json.When built using ts-loader and webpack, it builds normally and creates a
.js
file, but the path of the import statement in the.d.ts
file is still displayed as an absolute path.I wonder why the generated
.d.ts
path is not converted.Expected Behaviour
The file path of the import statement in the
.d.ts
file must also be converted into a relative path.Actual Behaviour
The import statements in the
d.ts
file are displayed the same as the source code (in absolute path).Steps to Reproduce the Problem
Location of a Minimal Repository that Demonstrates the Issue.
The text was updated successfully, but these errors were encountered: