Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new redirect feature about DTS files.
redirect.dts
Controls the redirect of the import paths of output Typescript declaration files.
redirect.dts.path
Whether to automatically redirect the import paths of Typescript declaration output files.
boolean
true
When set to
true
, the compilerOptions.paths configured in thetsconfig.json
file will take effect, and the import path of the DTS output file will be redirected to the corresponding relative path.When set to
false
, the original import path will remain unchanged.When
compilerOptions.paths
is set to{ "@/*": ["src/*"] }
intsconfig.json
, the DTS output file will be redirected to the correct relative path:redirect.dts.extension
Whether to automatically redirect the file extension to import paths based on the Typescript declaration output files.
boolean
false
When set to
true
, the import paths in DTS files will be redirected to the corresponding JavaScript extension which can be resolved to corresponding DTS file.When set to
false
, the file extension will remain unchanged from the original import path in the rewritten import path of the output file (regardless of whether it is specified or specified as any value).:::note
The extension of the TypeScript declaration file is related to the dts.autoExtension configuration.
:::
For the
.d.mts
file, in some scenarios, the full extension of the module import path is needed to load correctly.Related Links
close: #263
close: #140
close: #409
Checklist