Skip to content

Commit d1d0aa5

Browse files
authored
docs(cn): translate configuration.md into Chinese (#1784)
2 parents c8e3b70 + 3ad1cbc commit d1d0aa5

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/content/reference/react-compiler/configuration.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Configuration
2+
title: 配置
33
---
44

55
<Intro>
66

7-
This page lists all configuration options available in React Compiler.
7+
本页列出 React 编译器的所有可用配置项。
88

99
</Intro>
1010

1111
<Note>
1212

13-
For most apps, the default options should work out of the box. If you have a special need, you can use these advanced options.
13+
对于大多数应用,默认选项开箱即用即可满足需求。如果你有特殊需求,你可以使用这些高级选项。
1414

1515
</Note>
1616

@@ -29,55 +29,55 @@ module.exports = {
2929

3030
---
3131

32-
## Compilation Control {/*compilation-control*/}
32+
## 编译控制 {/*compilation-control*/}
3333

34-
These options control *what* the compiler optimizes and *how* it selects components and hooks to compile.
34+
这些选项用于控制编译器优化的 **内容**,以及它 **如何** 选择要编译的组件和 hook。
3535

36-
* [`compilationMode`](/reference/react-compiler/compilationMode) controls the strategy for selecting functions to compile (e.g., all functions, only annotated ones, or intelligent detection).
36+
* [`compilationMode`](/reference/react-compiler/compilationMode) 控制选择要编译的函数的策略(例如:全部函数、仅带注解的函数,或自动检测)。
3737

3838
```js
3939
{
40-
compilationMode: 'annotation' // Only compile "use memo" functions
40+
compilationMode: 'annotation' // 仅编译 “use memo” 函数
4141
}
4242
```
4343

4444
---
4545

46-
## Version Compatibility {/*version-compatibility*/}
46+
## 版本兼容性 {/*version-compatibility*/}
4747

48-
React version configuration ensures the compiler generates code compatible with your React version.
48+
React 版本配置可确保编译器生成的代码与你的 React 版本兼容。
4949

50-
[`target`](/reference/react-compiler/target) specifies which React version you're using (17, 18, or 19).
50+
[`target`](/reference/react-compiler/target) 指定你正在使用的 React 版本(17、18 或 19)。
5151

5252
```js
53-
// For React 18 projects
53+
// 对于 React 18 项目
5454
{
55-
target: '18' // Also requires react-compiler-runtime package
55+
target: '18' // 还需要 react-compiler-runtime
5656
}
5757
```
5858

5959
---
6060

61-
## Error Handling {/*error-handling*/}
61+
## 错误处理 {/*error-handling*/}
6262

63-
These options control how the compiler responds to code that doesn't follow the [Rules of React](/reference/rules).
63+
这些选项控制编译器如何处理不遵循 [React 规则](/reference/rules) 的代码。
6464

65-
[`panicThreshold`](/reference/react-compiler/panicThreshold) determines whether to fail the build or skip problematic components.
65+
[`panicThreshold`](/reference/react-compiler/panicThreshold) 决定是让构建失败还是跳过存在问题的组件。
6666

6767
```js
68-
// Recommended for production
68+
// 推荐用于生产环境
6969
{
70-
panicThreshold: 'none' // Skip components with errors instead of failing the build
70+
panicThreshold: 'none' // 跳过有错误的组件,而不是导致构建失败
7171
}
7272
```
7373

7474
---
7575

76-
## Debugging {/*debugging*/}
76+
## 调试 {/*debugging*/}
7777

78-
Logging and analysis options help you understand what the compiler is doing.
78+
日志和分析选项有助于你理解编译器在做什么。
7979

80-
[`logger`](/reference/react-compiler/logger) provides custom logging for compilation events.
80+
[`logger`](/reference/react-compiler/logger) 为编译事件提供自定义日志功能。
8181

8282
```js
8383
{
@@ -95,9 +95,9 @@ Logging and analysis options help you understand what the compiler is doing.
9595

9696
## Feature Flags {/*feature-flags*/}
9797

98-
Conditional compilation lets you control when optimized code is used.
98+
条件式编译使你控制何时使用优化后的代码。
9999

100-
[`gating`](/reference/react-compiler/gating) enables runtime feature flags for A/B testing or gradual rollouts.
100+
[`gating`](/reference/react-compiler/gating) 启用运行环境 feature flags,用于 A/B 测试或渐进式发布。
101101

102102
```js
103103
{
@@ -110,11 +110,11 @@ Conditional compilation lets you control when optimized code is used.
110110

111111
---
112112

113-
## Common Configuration Patterns {/*common-patterns*/}
113+
## 常见配置模式 {/*common-patterns*/}
114114

115-
### Default configuration {/*default-configuration*/}
115+
### 默认配置 {/*default-configuration*/}
116116

117-
For most React 19 applications, the compiler works without configuration:
117+
对于大多数 React 19 应用,编译器无需配置即可工作:
118118

119119
```js
120120
// babel.config.js
@@ -125,9 +125,9 @@ module.exports = {
125125
};
126126
```
127127

128-
### React 17/18 projects {/*react-17-18*/}
128+
### React 17/18 项目 {/*react-17-18*/}
129129

130-
Older React versions need the runtime package and target configuration:
130+
较旧的 React 版本需要安装运行环境包并设置 target
131131

132132
```bash
133133
npm install react-compiler-runtime@rc
@@ -139,13 +139,13 @@ npm install react-compiler-runtime@rc
139139
}
140140
```
141141

142-
### Incremental adoption {/*incremental-adoption*/}
142+
### 渐进式接入 {/*incremental-adoption*/}
143143

144-
Start with specific directories and expand gradually:
144+
从特定目录开始并逐步扩大范围:
145145

146146
```js
147147
{
148-
compilationMode: 'annotation' // Only compile "use memo" functions
148+
compilationMode: 'annotation' 仅编译 “use memo” 函数
149149
}
150150
```
151151

0 commit comments

Comments
 (0)