Skip to content
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
1 change: 1 addition & 0 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ export async function createConstantRsbuildConfig(): Promise<EnvironmentConfig>
chunkSplit: {
strategy: 'custom',
},
buildCache: true,
},
tools: {
htmlPlugin: false,
Expand Down
83 changes: 83 additions & 0 deletions packages/core/tests/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,23 @@ exports[`Should compose create Rsbuild config correctly > Enable experiment.adva
force: false
}
},
cache: {
type: 'persistent',
version: 'esm-development',
storage: {
type: 'filesystem',
directory: '<WORKSPACE>/node_modules/.cache/rspack'
},
buildDependencies: [
'<WORKSPACE>/package.json',
'<WORKSPACE>/tsconfig.json'
]
},
asyncWebAssembly: true,
outputModule: true
},
devtool: false,
cache: true,
externals: [
function () { /* omitted long function */ },
/^@rsbuild\\/core($|\\/|\\\\)/,
Expand Down Expand Up @@ -1064,10 +1077,23 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
force: false
}
},
cache: {
type: 'persistent',
version: 'esm-development',
storage: {
type: 'filesystem',
directory: '<WORKSPACE>/node_modules/.cache/rspack'
},
buildDependencies: [
'<WORKSPACE>/package.json',
'<WORKSPACE>/tsconfig.json'
]
},
asyncWebAssembly: true,
outputModule: true
},
devtool: false,
cache: true,
externals: [
function () { /* omitted long function */ },
/^@rsbuild\\/core($|\\/|\\\\)/,
Expand Down Expand Up @@ -1800,9 +1826,22 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
force: false
}
},
cache: {
type: 'persistent',
version: 'cjs-development',
storage: {
type: 'filesystem',
directory: '<WORKSPACE>/node_modules/.cache/rspack'
},
buildDependencies: [
'<WORKSPACE>/package.json',
'<WORKSPACE>/tsconfig.json'
]
},
asyncWebAssembly: true
},
devtool: false,
cache: true,
externals: [
/^@rsbuild\\/core($|\\/|\\\\)/,
/^rsbuild-plugin-dts($|\\/|\\\\)/,
Expand Down Expand Up @@ -2529,9 +2568,22 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
force: false
}
},
cache: {
type: 'persistent',
version: 'umd-development',
storage: {
type: 'filesystem',
directory: '<WORKSPACE>/node_modules/.cache/rspack'
},
buildDependencies: [
'<WORKSPACE>/package.json',
'<WORKSPACE>/tsconfig.json'
]
},
asyncWebAssembly: true
},
devtool: false,
cache: true,
externals: [
'assert',
'assert/strict',
Expand Down Expand Up @@ -3163,9 +3215,22 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
force: false
}
},
cache: {
type: 'persistent',
version: 'iife-development',
storage: {
type: 'filesystem',
directory: '<WORKSPACE>/node_modules/.cache/rspack'
},
buildDependencies: [
'<WORKSPACE>/package.json',
'<WORKSPACE>/tsconfig.json'
]
},
asyncWebAssembly: true
},
devtool: false,
cache: true,
externals: [
'assert',
'assert/strict',
Expand Down Expand Up @@ -3798,9 +3863,22 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
force: false
}
},
cache: {
type: 'persistent',
version: 'mf-development',
storage: {
type: 'filesystem',
directory: '<WORKSPACE>/node_modules/.cache/rspack'
},
buildDependencies: [
'<WORKSPACE>/package.json',
'<WORKSPACE>/tsconfig.json'
]
},
asyncWebAssembly: true
},
devtool: false,
cache: true,
output: {
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
path: '<WORKSPACE>/dist',
Expand Down Expand Up @@ -4465,6 +4543,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"target": "node",
},
"performance": {
"buildCache": true,
"chunkSplit": {
"strategy": "custom",
},
Expand Down Expand Up @@ -4757,6 +4836,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"target": "node",
},
"performance": {
"buildCache": true,
"chunkSplit": {
"strategy": "custom",
},
Expand Down Expand Up @@ -5036,6 +5116,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"target": "node",
},
"performance": {
"buildCache": true,
"chunkSplit": {
"strategy": "custom",
},
Expand Down Expand Up @@ -5287,6 +5368,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"target": "node",
},
"performance": {
"buildCache": true,
"chunkSplit": {
"strategy": "custom",
},
Expand Down Expand Up @@ -5485,6 +5567,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"target": "web",
},
"performance": {
"buildCache": true,
"chunkSplit": {
"strategy": "custom",
},
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,11 @@ const updateConfigForTest =
(logLevel?: LogLevel) => (rslibConfig: RslibConfig) => {
Object.assign(rslibConfig, {
performance: {
...rslibConfig.performance,
// Do not print file size in tests
printFileSize: false,
// Do not use build cache in tests
buildCache: false,
},
logLevel,
});
Expand Down
7 changes: 2 additions & 5 deletions website/docs/en/config/rsbuild/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"source",
"output",
"tools",
{
"type": "file",
"name": "plugins",
"label": "plugins"
}
"performance",
"plugins"
]
1 change: 1 addition & 0 deletions website/docs/en/config/rsbuild/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ To learn more about Rslib configurations, check out [Configure Rslib](/guide/bas
- [source](/config/rsbuild/source): Options for input source code.
- [output](/config/rsbuild/output): Options for build outputs.
- [tools](/config/rsbuild/tools): Options for low-level tools.
- [performance](/config/rsbuild/performance): Options for performance.
- [plugins](/config/rsbuild/plugins): Configure Rsbuild plugins.
19 changes: 19 additions & 0 deletions website/docs/en/config/rsbuild/performance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { RsbuildDocBadge } from '@components/RsbuildDocBadge';

# performance

Options for performance.

## performance.buildCache <RsbuildDocBadge path="/config/performance/build-cache" text="performance.buildCache" />

To enable or configure persistent build cache.

Rslib enable persistent build cache by default in v0.17.3.

## performance.printFileSize <RsbuildDocBadge path="/config/performance/print-file-size" text="performance.printFileSize" />

Whether to print the file sizes after build.

## performance.removeConsole <RsbuildDocBadge path="/config/performance/remove-console" text="performance.removeConsole" />

Whether to remove `console.[methodName]` in build.
7 changes: 2 additions & 5 deletions website/docs/zh/config/rsbuild/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"source",
"output",
"tools",
{
"type": "file",
"name": "plugins",
"label": "plugins"
}
"performance",
"plugins"
]
1 change: 1 addition & 0 deletions website/docs/zh/config/rsbuild/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Rslib 继承了 Rsbuild 的配置,所以你也可以配置 <RsbuildDocBadge pa
- [source](/config/rsbuild/source): 与输入的源代码相关的选项。
- [output](/config/rsbuild/output): 与构建产物相关的选项。
- [tools](/config/rsbuild/tools): 与底层工具相关的选项。
- [performance](/config/rsbuild/performance): 与性能相关的选项。
- [plugins](/config/rsbuild/plugins): 配置 Rsbuild 插件。
19 changes: 19 additions & 0 deletions website/docs/zh/config/rsbuild/performance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { RsbuildDocBadge } from '@components/RsbuildDocBadge';

# performance

与性能相关的选项。

## performance.buildCache <RsbuildDocBadge path="/config/performance/build-cache" text="performance.buildCache" />

用于启用或配置持久化构建缓存。

Rslib 在 v0.17.3 版本中默认启用了持久化构建缓存。

## performance.printFileSize <RsbuildDocBadge path="/config/performance/print-file-size" text="performance.printFileSize" />

是否在构建后输出所有静态资源文件的体积。

## performance.removeConsole <RsbuildDocBadge path="/config/performance/remove-console" text="performance.removeConsole" />

是否自动移除代码中的 `console.[methodName]`。
Loading