Skip to content

Commit d7160a8

Browse files
authored
[compiler] Fix misleading code example (#7889)
When the compiler bails out on code, it leaves it untouched and unoptimized, so it's always safe for the compiler to bailout. `panicThreshold` in most cases should be kept as `'none'` unless you want to fail the build on these safe bailouts. It's really only useful during dev when you're working on increasing the coverage of the compiler on your codebase. I think having it shown here is confusing so I'm opting to just remove it for this particular code example.
1 parent b165e71 commit d7160a8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/content/learn/react-compiler/incremental-adoption.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ module.exports = {
101101
test: './src/experimental/**/*.{js,jsx,ts,tsx}',
102102
plugins: [
103103
['babel-plugin-react-compiler', {
104-
compilationMode: 'annotation', // Only compile "use memo" components
105-
panicThreshold: 'none' // More permissive for experimental code
104+
// options ...
106105
}]
107106
]
108107
},
109108
{
110109
test: './src/production/**/*.{js,jsx,ts,tsx}',
111110
plugins: [
112111
['babel-plugin-react-compiler', {
113-
panicThreshold: 'critical_errors' // Stricter for production code
112+
// options ...
114113
}]
115114
]
116115
}

0 commit comments

Comments
 (0)