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
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
# rsbuild-plugin-dts
6
6
7
-
An Rsbuild plugin to emit declaration files for TypeScript which is built-in in Rslib.
7
+
An [Rsbuild plugin](https://www.npmjs.com/package/rsbuild-plugin-dts) to emit declaration files for TypeScript which is built-in in Rslib.
8
8
9
9
## Using in Rslib
10
10
@@ -18,7 +18,7 @@ Install:
18
18
npm add rsbuild-plugin-dts -D
19
19
```
20
20
21
-
Add plugin to your `rsbuild.config.ts`:
21
+
Add plugin to `rsbuild.config.ts`:
22
22
23
23
```ts
24
24
// rsbuild.config.ts
@@ -38,15 +38,15 @@ export default {
38
38
39
39
Whether to bundle the DTS files.
40
40
41
-
If you want to generate [bundle DTS](https://lib.rsbuild.dev/guide/advanced/dts#bundle-dts) files, you should:
41
+
If you want to [bundle DTS](https://lib.rsbuild.dev/guide/advanced/dts#bundle-dts) files, you should:
42
42
43
-
- Install `@microsoft/api-extractor` as a development dependency.
43
+
1. Install `@microsoft/api-extractor` as a development dependency, which is the underlying tool used for bundling DTS files.
44
44
45
45
```bash
46
46
npm add @microsoft/api-extractor -D
47
47
```
48
48
49
-
- Set `bundle` to `true`.
49
+
2. Set `bundle` to `true`.
50
50
51
51
```js
52
52
pluginDts({
@@ -75,7 +75,7 @@ pluginDts({
75
75
-**Type:**`boolean`
76
76
-**Default:**`false`
77
77
78
-
Determines whether to generate DTS files while building the project's references. This is equivalent to using the `--build` flag with the `tsc` command.
78
+
Determines whether to generate DTS files while building the project references. This is equivalent to using the `--build` flag with the `tsc` command. See [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) for more details.
79
79
80
80
When this option is enabled, you must explicitly set `declarationDir` or `outDir` in `tsconfig.json` in order to meet the build requirements.
81
81
@@ -86,7 +86,9 @@ When this option is enabled, you must explicitly set `declarationDir` or `outDir
86
86
87
87
Whether to abort the build process when an error occurs during DTS generation.
88
88
89
-
By default, type errors will cause the build to fail. When `abortOnError` is set to `false`, the build will still succeed even if there are type issues in the code.
89
+
By default, type errors will cause the build to fail.
90
+
91
+
When `abortOnError` is set to `false`, the build will still succeed even if there are type issues in the code.
90
92
91
93
```js
92
94
pluginDts({
@@ -153,14 +155,14 @@ pluginDts({
153
155
-**Type:**`string`
154
156
-**Default:**`undefined`
155
157
158
+
Inject content into the bottom of each DTS file.
159
+
156
160
```js
157
161
pluginDts({
158
162
footer:'/** @footer */',
159
163
});
160
164
```
161
165
162
-
Inject content into the bottom of each DTS file.
163
-
164
166
## Contributing
165
167
166
168
Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).
When we bundle DTS files, we should specify which third-party package types need to be bundled, refer to the [Handle Third-Party Dependencies](/guide/advanced/third-party-deps) documentation for more details about externals related configurations.
98
+
95
99
### dts.distPath
96
100
97
101
-**Type:**`string`
@@ -126,7 +130,7 @@ export default {
126
130
-**Type:**`boolean`
127
131
-**Default:**`false`
128
132
129
-
Determines whether to generate DTS files while building the project's references. This is equivalent to using the `--build` flag with the `tsc` command.
133
+
Determines whether to generate DTS files while building the project references. This is equivalent to using the `--build` flag with the `tsc` command. See [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) for more details.
130
134
131
135
::: note
132
136
@@ -141,7 +145,9 @@ When this option is enabled, you must explicitly set `declarationDir` or `outDir
141
145
142
146
Whether to abort the build process when an error occurs during DTS generation.
143
147
144
-
By default, type errors will cause the build to fail. When `abortOnError` is set to `false`, the build will still succeed even if there are type issues in the code.
148
+
By default, type errors will cause the build to fail.
149
+
150
+
When `abortOnError` is set to `false` like below, the build will still succeed even if there are type issues in the code.
- Set `dts: { bundle: true }` in the Rslib configuration file.
59
+
2. Set `dts: { bundle: true }` in the Rslib configuration file.
60
+
61
+
::: tip
60
62
61
63
You can refer to [lib.dts](/config/lib/dts) for more details about DTS configuration.
62
64
63
-
- Specify which third-party package types need to be bundled, refer to the [Handle Third-Party Dependencies](/guide/advanced/third-party-deps) documentation for more details about externals related configurations.
0 commit comments