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
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,8 @@ pluginDts({
136
136
});
137
137
```
138
138
139
+
> When [tsgo](#tsgo) is enabled, if the project also enables [build](#build) or emits declaration files with different extensions to the same directory, `dtsExtension` may not work correctly.
140
+
139
141
### alias
140
142
141
143
-**Type:**`Record<string, string>`
@@ -280,6 +282,41 @@ import { foo } from './foo.mjs'; // expected output of './dist/bar.d.mts'
280
282
281
283
- 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).
282
284
285
+
### tsgo
286
+
287
+
-**Type:**`boolean`
288
+
-**Default:**`false`
289
+
290
+
Whether to generate declaration files with [tsgo](https://github.com/microsoft/typescript-go), which can provide faster generation of declaration files, especially for large projects.
291
+
292
+
> This feature is currently an **experimental feature**. Since tsgo is still in the **experimental stage**, there may be some bugs and unresolved issues or limitations. So, make sure to fully test it in your project before enabling this option.
293
+
294
+
To enable this option, you need to:
295
+
296
+
1. Install [@typescript/native-preview](https://www.npmjs.com/package/@typescript/native-preview) as a development dependency.
297
+
298
+
```bash
299
+
npm add @typescript/native-preview -D
300
+
```
301
+
302
+
> `@typescript/native-preview` requires Node.js 20.6.0 or higher.
303
+
304
+
2. Set `tsgo` to `true`.
305
+
306
+
```js
307
+
pluginDts({
308
+
tsgo:true,
309
+
});
310
+
```
311
+
312
+
3. In order to ensure the consistency of local development, you need to install the corresponding [VS Code Preview Extension](https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.native-preview) and add the following configuration in the VS Code settings:
313
+
314
+
```json
315
+
{
316
+
"typescript.experimental.useTsgo": true
317
+
}
318
+
```
319
+
283
320
## Contributing
284
321
285
322
Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).
0 commit comments