diff --git a/e2e/cases/resolve/node-imports-field/index.test.ts b/e2e/cases/resolve/node-imports-field/index.test.ts index 4e87474d44..7904d0dcb7 100644 --- a/e2e/cases/resolve/node-imports-field/index.test.ts +++ b/e2e/cases/resolve/node-imports-field/index.test.ts @@ -1,6 +1,9 @@ import { expect, test } from '@e2e/helper'; -test('should resolve package.json imports field in dev', async ({ page, dev }) => { +test('should resolve package.json imports field in dev', async ({ + page, + dev, +}) => { await dev(); const app = page.locator('#app'); diff --git a/packages/core/src/types/config.ts b/packages/core/src/types/config.ts index 3fabe961dd..e4d66bd5b1 100644 --- a/packages/core/src/types/config.ts +++ b/packages/core/src/types/config.ts @@ -800,6 +800,7 @@ export interface PerformanceConfig { /** * Analyze the size of output files. * @default undefined + * @deprecated Use Rsdoctor instead. */ bundleAnalyze?: BundleAnalyzerPlugin.Options; diff --git a/packages/core/tests/mergeConfig.test.ts b/packages/core/tests/mergeConfig.test.ts index d7611fc577..353fbde43c 100644 --- a/packages/core/tests/mergeConfig.test.ts +++ b/packages/core/tests/mergeConfig.test.ts @@ -517,8 +517,6 @@ describe('mergeRsbuildConfig', () => { }, }, }); - expect(mergeRsbuildConfig(undefined, undefined, undefined)).toEqual( - {}, - ); + expect(mergeRsbuildConfig(undefined, undefined, undefined)).toEqual({}); }); }); diff --git a/website/docs/en/config/performance/bundle-analyze.mdx b/website/docs/en/config/performance/bundle-analyze.mdx index 51dfe058b9..07cc29f92d 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/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/config/server/middleware-mode.mdx b/website/docs/en/config/server/middleware-mode.mdx index 80082db07d..096badd6b6 100644 --- a/website/docs/en/config/server/middleware-mode.mdx +++ b/website/docs/en/config/server/middleware-mode.mdx @@ -12,7 +12,6 @@ When this option is enabled, Rsbuild will not create an HTTP server. This option ### Enable middleware mode - ```ts title="rsbuild.config.ts" import { createRsbuild } from '@rsbuild/core'; diff --git a/website/docs/en/guide/optimization/optimize-bundle.mdx b/website/docs/en/guide/optimization/optimize-bundle.mdx index bc49066822..8b18ffda19 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 identify large libraries in your 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 981006bcb5..971609c235 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/webpack-bundle-analyzer) 插件来分析产物体积。 +:::tip +`performance.bundleAnalyze` 已被弃用,并将在 Rsbuild 2.0 移除,建议使用 [Rsdoctor](/guide/debug/rsdoctor) 来分析产物体积。 +::: + 默认情况下,Rsbuild 不会开启 `webpack-bundle-analyzer`。当开启该功能后,内部的默认配置如下: ```js diff --git a/website/docs/zh/config/server/middleware-mode.mdx b/website/docs/zh/config/server/middleware-mode.mdx index 7d736a20f2..448dba793a 100644 --- a/website/docs/zh/config/server/middleware-mode.mdx +++ b/website/docs/zh/config/server/middleware-mode.mdx @@ -12,7 +12,6 @@ ### 启用中间件模式 - ```ts title="rsbuild.config.ts" import { createRsbuild } from '@rsbuild/core'; 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 范围