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
Copy file name to clipboardexpand all lines: packages/plugin-dts/README.md
+71
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,77 @@ pluginDts({
163
163
});
164
164
```
165
165
166
+
### redirect
167
+
168
+
-**Type:**
169
+
170
+
```ts
171
+
typeDtsRedirect= {
172
+
path?:boolean;
173
+
extension?:boolean;
174
+
};
175
+
```
176
+
177
+
-**Default:**
178
+
179
+
```ts
180
+
const defaultRedirect = {
181
+
path: true,
182
+
extension: false,
183
+
};
184
+
```
185
+
186
+
Controls the redirect of the import paths of output TypeScript declaration files.
187
+
188
+
```js
189
+
pluginDts({
190
+
redirect: {
191
+
path:true,
192
+
extension:false,
193
+
},
194
+
});
195
+
```
196
+
197
+
#### redirect.path
198
+
199
+
-**Type:**`boolean`
200
+
-**Default:**`true`
201
+
202
+
Whether to automatically redirect the import paths of TypeScript declaration output files.
203
+
204
+
- When set to `true`, Rslib will redirect the import path in the DTS output file to the corresponding relative path based on the [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) configured in `tsconfig.json`.
205
+
206
+
```ts
207
+
// `compilerOptions.paths` is set to `{ "@/*": ["src/*"] }`
- When set to `false`, the original import path will remain unchanged.
216
+
217
+
#### redirect.extension
218
+
219
+
-**Type:**`boolean`
220
+
-**Default:**`false`
221
+
222
+
Whether to automatically redirect the file extension to import paths based on the TypeScript declaration output files.
223
+
224
+
- 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. The extension of the DTS output file is related to the `dtsExtension` configuration.
- 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).
236
+
166
237
## Contributing
167
238
168
239
Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).
0 commit comments