You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Valida la configuración del [modo de gating](/reference/react-compiler/gating).
8
+
9
+
</Intro>
10
+
11
+
## Detalles de la regla {/*rule-details*/}
12
+
13
+
El modo de gating te permite adoptar React Compiler gradualmente al marcar componentes específicos para optimización. Esta regla garantiza que tu configuración de gating sea válida para que el compilador sepa qué componentes procesar.
14
+
15
+
### Inválido {/*invalid*/}
16
+
17
+
Ejemplos de código incorrecto para esta regla:
18
+
19
+
```js
20
+
// ❌ Faltan campos obligatorios
21
+
module.exports= {
22
+
plugins: [
23
+
['babel-plugin-react-compiler', {
24
+
gating: {
25
+
importSpecifierName:'__experimental_useCompiler'
26
+
// Falta el campo 'source'
27
+
}
28
+
}]
29
+
]
30
+
};
31
+
32
+
// ❌ Tipo de gating inválido
33
+
module.exports= {
34
+
plugins: [
35
+
['babel-plugin-react-compiler', {
36
+
gating:'__experimental_useCompiler'// Debería ser un objeto
37
+
}]
38
+
]
39
+
};
40
+
```
41
+
42
+
### Válido {/*valid*/}
43
+
44
+
Ejemplos de código correcto para esta regla:
45
+
46
+
```js
47
+
// ✅ Configuración completa de gating
48
+
module.exports= {
49
+
plugins: [
50
+
['babel-plugin-react-compiler', {
51
+
gating: {
52
+
importSpecifierName:'isCompilerEnabled', // nombre de la función exportada
53
+
source:'featureFlags'// nombre del módulo
54
+
}
55
+
}]
56
+
]
57
+
};
58
+
59
+
// featureFlags.js
60
+
exportfunctionisCompilerEnabled() {
61
+
// ...
62
+
}
63
+
64
+
// ✅ Sin gating (compilar todo)
65
+
module.exports= {
66
+
plugins: [
67
+
['babel-plugin-react-compiler', {
68
+
// Sin campo gating - compila todos los componentes
0 commit comments