The panicThreshold option controls how the React Compiler handles errors during compilation.
{
panicThreshold: 'none' // Recommended
} panicThreshold
Determines whether compilation errors should fail the build or skip optimization.
'none' | 'critical_errors' | 'all_errors' 'none'
'none' (default, recommended): Skip components that can’t be compiled and continue building'critical_errors': Fail the build only on critical compiler errors'all_errors': Fail the build on any compiler diagnostic'none'
'none'
For production builds, always use 'none'. This is the default value:
{
panicThreshold: 'none'
} This ensures:
Temporarily use stricter thresholds to find issues:
const isDevelopment = process.env.NODE_ENV === 'development';
{
panicThreshold: isDevelopment ? 'critical_errors' : 'none',
logger: {
logEvent(filename, event) {
if (isDevelopment && event.kind === 'CompileError') {
// ...
}
}
}
}
© 2013–present Facebook Inc.
Licensed under the Creative Commons Attribution 4.0 International Public License.
https://react.dev/reference/react-compiler/panicThreshold