Skip to content
Draft
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
2 changes: 2 additions & 0 deletions packages/core/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,8 @@ export interface PerformanceConfig {

/**
* Analyze the size of output files.
* @default undefined
* @deprecated Use Rsdoctor instead.
*/
bundleAnalyze?: BundleAnalyzerPlugin.Options;

Expand Down
5 changes: 5 additions & 0 deletions website/docs/en/config/performance/bundle-analyze.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# performance.bundleAnalyze

- **Type:** `Object | undefined`
- **Default:** `undefined`

Used to enable the [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) plugin to analyze the size of the output.

:::tip
`performance.bundleAnalyze` has been deprecated and will be removed in Rsbuild 2.0. We recommend using [Rsdoctor](/guide/debug/rsdoctor) to analyze your bundle size instead.
:::

By default, Rsbuild does not enable `webpack-bundle-analyzer`. When this feature is enabled, the default configuration is as follows:

```js
Expand Down
8 changes: 1 addition & 7 deletions website/docs/en/guide/optimization/optimize-bundle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ npx yarn-deduplicate && yarn

We recommend using lightweight libraries in your project, such as replacing [moment](https://momentjs.com/) with [day.js](https://day.js.org/).

To find out the large libraries in the project, add the `BUNDLE_ANALYZE=true` environment variable when building:

```bash
BUNDLE_ANALYZE=true pnpm build
```

See the [performance.bundleAnalyze](/config/performance/bundle-analyze) configuration for details.
To find out large third-party libraries in your project, use Rsdoctor to analyze the bundle size. For more details, see [Using Rsdoctor](/guide/debug/rsdoctor).

## Adjust browserslist

Expand Down
5 changes: 5 additions & 0 deletions website/docs/zh/config/performance/bundle-analyze.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# performance.bundleAnalyze

- **类型:** `Object | undefined`
- **默认值:** `undefined`

用于开启 [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) 插件来分析产物体积。

:::tip
`performance.bundleAnalyze` 已被弃用,并将在 Rsbuild 2.0 移除,建议使用 [Rsdoctor](/guide/debug/rsdoctor) 来分析产物体积。
:::

默认情况下,Rsbuild 不会开启 `webpack-bundle-analyzer`。当开启该功能后,内部的默认配置如下:

```js
Expand Down
8 changes: 1 addition & 7 deletions website/docs/zh/guide/optimization/optimize-bundle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ npx yarn-deduplicate && yarn

建议将项目中体积较大的三方库替换为更轻量的库,比如将 [moment](https://momentjs.com/) 替换为 [day.js](https://day.js.org/)。

如果你需要找出项目中体积较大的三方库,可以在执行构建时添加 `BUNDLE_ANALYZE=true` 环境变量:

```bash
BUNDLE_ANALYZE=true pnpm build
```

详见 [performance.bundleAnalyze](/config/performance/bundle-analyze) 配置项。
如果你需要找出项目中体积较大的三方库,可以使用 Rsdoctor 来分析产物体积,详见 [使用 Rsdoctor](/guide/debug/rsdoctor)。

## 提升 Browserslist 范围

Expand Down
Loading