Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add more example for cleanDistPath #980

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: add more example for cleanDistPath
  • Loading branch information
chenjiahan committed Dec 17, 2023
commit 92dcdbc1363d501798930bd254e2cd30c48518b2
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',
},
};
```