@@ -4,72 +4,72 @@ title: panicThreshold
44
55<Intro >
66
7- The ` panicThreshold ` option controls how the React Compiler handles errors during compilation.
7+ ` panicThreshold ` 选项用于控制 React 编译器在编译过程中如何处理错误。
88
99</Intro >
1010
1111``` js
1212{
13- panicThreshold: ' none' // Recommended
13+ panicThreshold: ' none' // 推荐
1414}
1515```
1616
1717<InlineToc />
1818
1919---
2020
21- ## Reference {/* reference* /}
21+ ## 参考 {/* reference* /}
2222
2323### ` panicThreshold ` {/* panicthreshold* /}
2424
25- Determines whether compilation errors should fail the build or skip optimization.
25+ 决定编译错误是导致构建失败,还是仅跳过优化。
2626
27- #### Type {/* type* /}
27+ #### 类型 {/* type* /}
2828
2929```
3030'none' | 'critical_errors' | 'all_errors'
3131```
3232
33- #### Default value {/* default-value* /}
33+ #### 默认值 {/* default-value* /}
3434
3535` 'none' `
3636
37- #### Options {/* options* /}
37+ #### 选项 {/* options* /}
3838
39- - ** ` 'none' ` ** (default, recommended): Skip components that can't be compiled and continue building
40- - ** ` 'critical_errors' ` ** : Fail the build only on critical compiler errors
41- - ** ` 'all_errors' ` ** : Fail the build on any compiler diagnostic
39+ - ** ` 'none' ` ** (默认, 推荐): 跳过无法编译的组件并继续构建
40+ - ** ` 'critical_errors' ` ** : 仅在关键编译器错误时使构建失败
41+ - ** ` 'all_errors' ` ** : 遇到任何编译诊断即使构建失败
42+
43+ #### 注意事项 {/* caveats* /}
4244
43- #### Caveats {/* caveats* /}
44-
45- - Production builds should always use ` 'none' `
46- - Build failures prevent your application from building
47- - The compiler automatically detects and skips problematic code with ` 'none' `
48- - Higher thresholds are only useful during development for debugging
45+ - 生产环境构建应始终使用 ` 'none' `
46+ - 构建失败会阻止你的应用构建
47+ - 使用 ` 'none' ` 时,编译器会自动检测并跳过有问题的代码
48+ - 更高的阈值仅在开发调试时有用
4949
5050---
5151
52- ## Usage {/* usage* /}
52+ ## 用法 {/* usage* /}
5353
54- ### Production configuration (recommended) {/* production-configuration* /}
54+ ### 生产环境配置(推荐) {/* production-configuration* /}
5555
56- For production builds, always use ` 'none' ` . This is the default value:
56+ 对于生产构建,始终使用 ` 'none' ` 。这是默认值:
5757
5858``` js
5959{
6060 panicThreshold: ' none'
6161}
6262```
6363
64- This ensures:
65- - Your build never fails due to compiler issues
66- - Components that can't be optimized run normally
67- - Maximum components get optimized
68- - Stable production deployments
64+ 这样可以确保:
65+ - 构建不会因编译器问题而失败
66+ - 无法优化的组件仍可正常运行
67+ - 尽可能多的组件会被优化
68+ - 生产部署更加稳定
6969
70- ### Development debugging {/* development-debugging* /}
70+ ### 开发调试 {/* development-debugging* /}
7171
72- Temporarily use stricter thresholds to find issues:
72+ 可临时使用更严格的阈值来定位问题:
7373
7474``` js
7575const isDevelopment = process .env .NODE_ENV === ' development' ;
@@ -84,4 +84,4 @@ const isDevelopment = process.env.NODE_ENV === 'development';
8484 }
8585 }
8686}
87- ```
87+ ```
0 commit comments