Skip to content

Commit 818c91c

Browse files
committed
up doc
1 parent 5c4dd28 commit 818c91c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

website/docs/en/config/lib/out-base.mdx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# lib.outBase
22

3-
- **Type:** `boolean`
3+
- **Type:** `string`
44
- **Default Value:** `undefined`
55

66
:::info
@@ -28,7 +28,7 @@ For example, we have the following directory structure:
2828
└── index.ts
2929
```
3030

31-
If the output base directory is not specified, the lowest common ancestor of all input entry point paths, i.e. `src/utils`, is used by default, and the final file output structure is:
31+
If the output base directory is not specified, the lowest common ancestor of all input entry point paths, i.e. `./src/utils`, is used by default, and the final file output structure is:
3232

3333
```txt
3434
dist
@@ -50,3 +50,11 @@ dist
5050
│ └── index.js
5151
└── index.js
5252
```
53+
54+
::: tip
55+
56+
When the project needs to generate DTS type declaration files, to ensure that the generated DTS files and JS files maintain a consistent output directory structure, if you modify the `outBase` configuration, you need to also modify the [rootDir](https://www.typescriptlang.org/tsconfig/rootDir.html) in `tsconfig.json` to the same path.
57+
58+
If `outBase` is not configured, both Rslib and TypeScript will use the lowest common ancestor of all entry file paths as the output directory by default, so there is no need to additionally configure [rootDir](https://www.typescriptlang.org/tsconfig/rootDir.html).
59+
60+
:::

website/docs/zh/config/lib/out-base.mdx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# lib.outBase
22

3-
- **类型:** `boolean`
3+
- **类型:** `string`
44
- **默认值:** `undefined`
55

66
:::info
@@ -28,7 +28,7 @@
2828
└── index.ts
2929
```
3030

31-
如果未指定基础输出目录,则默认使用所有输入入口文件路径的最近公共祖先目录,即 `src/utils`,最终的文件输出结构为:
31+
如果未指定基础输出目录,则默认使用所有输入入口文件路径的最近公共祖先目录,即 `./src/utils`,最终的文件输出结构为:
3232

3333
```txt
3434
dist
@@ -50,3 +50,11 @@ dist
5050
│ └── index.js
5151
└── index.js
5252
```
53+
54+
::: tip
55+
56+
当项目需要生成 DTS 类型声明文件时,为了保证生成的 DTS 文件与 JS 文件保持一致的输出目录结构,如果修改了 `outBase` 配置,需要同时修改 `tsconfig.json` 中的 [rootDir](https://www.typescriptlang.org/tsconfig/rootDir.html) 为相同的路径。
57+
58+
在没有配置 `outBase` 的情况下,Rslib 与 TypeScript 默认都会使用所有入口文件路径的最近公共祖先作为输出目录,所以不需要额外配置 [rootDir](https://www.typescriptlang.org/tsconfig/rootDir.html)
59+
60+
:::

0 commit comments

Comments
 (0)