diff --git a/packages/core/src/types/config.ts b/packages/core/src/types/config.ts index cd91be553f..ed5a3602a6 100644 --- a/packages/core/src/types/config.ts +++ b/packages/core/src/types/config.ts @@ -733,6 +733,8 @@ export interface PerformanceConfig { /** * Analyze the size of output files. + * @default undefined + * @deprecated Use Rsdoctor instead. */ bundleAnalyze?: BundleAnalyzerPlugin.Options; diff --git a/website/docs/en/config/performance/bundle-analyze.mdx b/website/docs/en/config/performance/bundle-analyze.mdx index 219fce1090..1b43498413 100644 --- a/website/docs/en/config/performance/bundle-analyze.mdx +++ b/website/docs/en/config/performance/bundle-analyze.mdx @@ -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 diff --git a/website/docs/en/guide/optimization/optimize-bundle.mdx b/website/docs/en/guide/optimization/optimize-bundle.mdx index cd9de16e17..aba5b89f89 100644 --- a/website/docs/en/guide/optimization/optimize-bundle.mdx +++ b/website/docs/en/guide/optimization/optimize-bundle.mdx @@ -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 diff --git a/website/docs/zh/config/performance/bundle-analyze.mdx b/website/docs/zh/config/performance/bundle-analyze.mdx index cb9a9a6870..6eba65c1c7 100644 --- a/website/docs/zh/config/performance/bundle-analyze.mdx +++ b/website/docs/zh/config/performance/bundle-analyze.mdx @@ -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 diff --git a/website/docs/zh/guide/optimization/optimize-bundle.mdx b/website/docs/zh/guide/optimization/optimize-bundle.mdx index e79796a707..94e8463017 100644 --- a/website/docs/zh/guide/optimization/optimize-bundle.mdx +++ b/website/docs/zh/guide/optimization/optimize-bundle.mdx @@ -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 范围