From 6d8bbb2601421c7b1c0503a0414c470bd6cafb8d Mon Sep 17 00:00:00 2001 From: Timeless0911 <1604889533@qq.com> Date: Mon, 7 Jul 2025 17:34:43 +0800 Subject: [PATCH] feat: enable `performance.buildCache` by default --- packages/core/src/config.ts | 1 + packages/core/tests/__snapshots__/config.test.ts.snap | 5 +++++ .../auto-external/module-import-warn/rslib.config.ts | 3 +++ tests/integration/bundle-false/basic/.gitignore | 3 ++- .../dts/bundle-false/tsconfig-path/rslib.config.ts | 3 +++ .../integration/externals/module-import-warn/rslib.config.ts | 3 +++ tests/integration/redirect/style/.gitignore | 3 ++- tests/scripts/shared.ts | 1 + website/rspress.config.ts | 2 +- 9 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 8ae913792..b0191ff75 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -508,6 +508,7 @@ export async function createConstantRsbuildConfig(): Promise chunkSplit: { strategy: 'custom', }, + buildCache: true, }, tools: { htmlPlugin: false, diff --git a/packages/core/tests/__snapshots__/config.test.ts.snap b/packages/core/tests/__snapshots__/config.test.ts.snap index ed84621f4..17fa37d61 100644 --- a/packages/core/tests/__snapshots__/config.test.ts.snap +++ b/packages/core/tests/__snapshots__/config.test.ts.snap @@ -112,6 +112,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i "target": "node", }, "performance": { + "buildCache": true, "chunkSplit": { "strategy": "custom", }, @@ -382,6 +383,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i "target": "node", }, "performance": { + "buildCache": true, "chunkSplit": { "strategy": "custom", }, @@ -636,6 +638,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i "target": "node", }, "performance": { + "buildCache": true, "chunkSplit": { "strategy": "custom", }, @@ -865,6 +868,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i "target": "node", }, "performance": { + "buildCache": true, "chunkSplit": { "strategy": "custom", }, @@ -1048,6 +1052,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i "target": "web", }, "performance": { + "buildCache": true, "chunkSplit": { "strategy": "custom", }, diff --git a/tests/integration/auto-external/module-import-warn/rslib.config.ts b/tests/integration/auto-external/module-import-warn/rslib.config.ts index 438ac421c..e2222a8a2 100644 --- a/tests/integration/auto-external/module-import-warn/rslib.config.ts +++ b/tests/integration/auto-external/module-import-warn/rslib.config.ts @@ -24,4 +24,7 @@ export default defineConfig({ 'e7', ], }, + performance: { + buildCache: false, + }, }); diff --git a/tests/integration/bundle-false/basic/.gitignore b/tests/integration/bundle-false/basic/.gitignore index 9bfb325f1..4ae55a0ab 100644 --- a/tests/integration/bundle-false/basic/.gitignore +++ b/tests/integration/bundle-false/basic/.gitignore @@ -1 +1,2 @@ -!node_modules/ \ No newline at end of file +!node_modules/ +.cache \ No newline at end of file diff --git a/tests/integration/dts/bundle-false/tsconfig-path/rslib.config.ts b/tests/integration/dts/bundle-false/tsconfig-path/rslib.config.ts index 15b3adf69..201315dd2 100644 --- a/tests/integration/dts/bundle-false/tsconfig-path/rslib.config.ts +++ b/tests/integration/dts/bundle-false/tsconfig-path/rslib.config.ts @@ -10,6 +10,9 @@ export default defineConfig({ }, }), ], + performance: { + buildCache: false, + }, source: { entry: { index: '../__fixtures__/src/index.ts', diff --git a/tests/integration/externals/module-import-warn/rslib.config.ts b/tests/integration/externals/module-import-warn/rslib.config.ts index bcef068da..6bcfc6df0 100644 --- a/tests/integration/externals/module-import-warn/rslib.config.ts +++ b/tests/integration/externals/module-import-warn/rslib.config.ts @@ -17,4 +17,7 @@ export default defineConfig({ output: { externals: ['bar', /^qux$/, 'quxx'], }, + performance: { + buildCache: false, + }, }); diff --git a/tests/integration/redirect/style/.gitignore b/tests/integration/redirect/style/.gitignore index 9bfb325f1..4ae55a0ab 100644 --- a/tests/integration/redirect/style/.gitignore +++ b/tests/integration/redirect/style/.gitignore @@ -1 +1,2 @@ -!node_modules/ \ No newline at end of file +!node_modules/ +.cache \ No newline at end of file diff --git a/tests/scripts/shared.ts b/tests/scripts/shared.ts index 4dc5cfc96..c6becbdce 100644 --- a/tests/scripts/shared.ts +++ b/tests/scripts/shared.ts @@ -207,6 +207,7 @@ export async function getResults( const updateConfigForTest = (rslibConfig: RslibConfig) => { Object.assign(rslibConfig, { performance: { + ...rslibConfig.performance, // Do not print file size in tests printFileSize: false, }, diff --git a/website/rspress.config.ts b/website/rspress.config.ts index 093c38794..e057883d1 100644 --- a/website/rspress.config.ts +++ b/website/rspress.config.ts @@ -141,7 +141,7 @@ export default defineConfig({ dev: { lazyCompilation: true, }, - resolve: { + source: { alias: { '@components': path.join(__dirname, '@components'), '@en': path.join(__dirname, 'docs/en'),