File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,24 @@ import { PackageManagerTabs } from '@theme';
5858
59592 . Set ` dts: { bundle: true } ` in the Rslib configuration file.
6060
61+ It should be noted that when generating declaration files, Rslib automatically sets some configuration options in ` tsconfig.json ` by default:
62+
63+ ``` json
64+ {
65+ "compilerOptions" : {
66+ "noEmit" : false ,
67+ "declaration" : true ,
68+ "emitDeclarationOnly" : true
69+ }
70+ }
71+ ```
72+
73+ The priority from highest to lowest of final output directory of declaration files:
74+
75+ - The configuration option [ dts.distPath] ( /config/lib/dts#dtsdistpath )
76+ - The configuration option ` declarationDir ` in ` tsconfig.json `
77+ - The configuration option [ output.distPath.root] ( /config/rsbuild/output#outputdistpath )
78+
6179::: tip
6280
6381You can refer to [ lib.dts] ( /config/lib/dts ) for more details about declaration files configuration.
Original file line number Diff line number Diff line change @@ -58,6 +58,24 @@ import { PackageManagerTabs } from '@theme';
5858
59592 . 在 Rslib 配置文件中设置 ` dts: { bundle: true } ` 。
6060
61+ 需要注意的是,Rslib 在生成类型声明文件的过程中,默认会将 ` tsconfig.json ` 中的一些配置项设置为:
62+
63+ ``` json
64+ {
65+ "compilerOptions" : {
66+ "noEmit" : false ,
67+ "declaration" : true ,
68+ "emitDeclarationOnly" : true
69+ }
70+ }
71+ ```
72+
73+ 最终类型声明文件输出目录的优先级从高到低为:
74+
75+ - [ dts.distPath] ( /config/lib/dts#dtsdistpath ) 配置项
76+ - ` tsconfig.json ` 中的 ` declarationDir ` 配置项
77+ - [ output.distPath.root] ( /config/rsbuild/output#outputdistpath ) 配置项
78+
6179::: tip
6280
6381你可以参考 [ lib.dts] ( /config/lib/dts ) 获取更多有关类型声明文件配置的详细信息。
You can’t perform that action at this time.
0 commit comments