Skip to content

Commit

Permalink
docs: add more example for cleanDistPath (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Dec 17, 2023
1 parent 85a3d29 commit 9973405
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions packages/document/docs/en/config/output/clean-dist-path.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
- **Type:** `boolean`
- **Default:** `true`

Whether to clean all files in the dist path before starting compilation.
Whether to clean up all files under the output directory (default is `dist`) before the build starts.

By default, Rsbuild clean up the dist file, you can disable this behavior by setting `cleanDistPath` to `false`.
By default, Rsbuild automatically cleans the files under the output directory. You can set `cleanDistPath` to `false` to disable this behavior.

```js
export default {
Expand All @@ -14,3 +14,13 @@ export default {
},
};
```

If you only need to clean files before the production build, and not in the development build, you can configure it as follows:

```js
export default {
output: {
cleanDistPath: process.env.NODE_ENV === 'production',
},
};
```
14 changes: 12 additions & 2 deletions packages/document/docs/zh/config/output/clean-dist-path.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
- **类型:** `boolean`
- **默认值:** `true`

是否在构建开始前清理 dist 目录下的所有文件
是否在构建开始前清理产物目录(默认为 `dist`)下的所有文件

默认情况下,Rsbuild 会自动清理 dist 目录下的文件,你可以把 `cleanDistPath` 设置为 `false` 来禁用该行为。
默认情况下,Rsbuild 会自动清理产物目录下的文件,你可以把 `cleanDistPath` 设置为 `false` 来禁用该行为。

```js
export default {
Expand All @@ -14,3 +14,13 @@ export default {
},
};
```

如果你只需要在生产环境构建前清理文件,而在开发环境构建前不需要,那么可以配置为:

```js
export default {
output: {
cleanDistPath: process.env.NODE_ENV === 'production',
},
};
```

0 comments on commit 9973405

Please sign in to comment.