@@ -4,145 +4,145 @@ title: target
44
55<Intro >
66
7- The ` target ` option specifies which React version the compiler should generate code for .
7+ A opção ` target ` especifica para qual versão do React o compilador deve gerar o código .
88
99</Intro >
1010
1111``` js
1212{
13- target: ' 19' // or '18', '17'
13+ target: ' 19' // ou '18', '17'
1414}
1515```
1616
1717<InlineToc />
1818
1919---
2020
21- ## Reference {/* reference* /}
21+ ## Referência {/* reference* /}
2222
2323### ` target ` {/* target* /}
2424
25- Configures the React version compatibility for the compiled output .
25+ Configura a compatibilidade da versão do React para a saída compilada .
2626
27- #### Type {/* type* /}
27+ #### Tipo {/* type* /}
2828
2929```
3030'17' | '18' | '19'
3131```
3232
33- #### Default value {/* default-value* /}
33+ #### Valor padrão {/* default-value* /}
3434
3535` '19' `
3636
37- #### Valid values {/* valid-values* /}
37+ #### Valores válidos {/* valid-values* /}
3838
39- - ** ` '19' ` ** : Target React 19 (default ). No additional runtime required .
40- - ** ` '18' ` ** : Target React 18. Requires ` react-compiler-runtime ` package .
41- - ** ` '17' ` ** : Target React 17. Requires ` react-compiler-runtime ` package .
39+ - ** ` '19' ` ** : Destina-se ao React 19 (padrão ). Nenhum runtime adicional é necessário .
40+ - ** ` '18' ` ** : Destina-se ao React 18. Requer o pacote ` react-compiler-runtime ` .
41+ - ** ` '17' ` ** : Destina-se ao React 17. Requer o pacote ` react-compiler-runtime ` .
4242
43- #### Caveats {/* caveats* /}
43+ #### Ressalvas {/* caveats* /}
4444
45- - Always use string values, not numbers (e.g. , ` '17' ` not ` 17 ` )
46- - Don't include patch versions (e.g. , use ` '18' ` not ` '18.2.0' ` )
47- - React 19 includes built-in compiler runtime APIs
48- - React 17 and 18 require installing ` react-compiler-runtime@latest `
45+ - Sempre use valores de string, não números (por exemplo , ` '17' ` e não ` 17 ` )
46+ - Não inclua versões de patch (por exemplo , use ` '18' ` e não ` '18.2.0' ` )
47+ - O React 19 inclui APIs de runtime do compilador integradas
48+ - React 17 e 18 exigem a instalação de ` react-compiler-runtime@latest `
4949
5050---
5151
52- ## Usage {/* usage* /}
52+ ## Uso {/* usage* /}
5353
54- ### Targeting React 19 (default ) {/* targeting-react-19* /}
54+ ### Destinando-se ao React 19 (padrão ) {/* targeting-react-19* /}
5555
56- For React 19, no special configuration is needed :
56+ Para o React 19, nenhuma configuração especial é necessária :
5757
5858``` js
5959{
60- // defaults to target: '19'
60+ // usa target: '19' por padrão
6161}
6262```
6363
64- The compiler will use React 19's built-in runtime APIs :
64+ O compilador usará as APIs de runtime nativas do React 19 :
6565
6666``` js
67- // Compiled output uses React 19's native APIs
67+ // A saída compilada usa as APIs nativas do React 19
6868import { c as _c } from ' react/compiler-runtime' ;
6969```
7070
71- ### Targeting React 17 or 18 {/* targeting-react-17-or-18* /}
71+ ### Destinando-se ao React 17 ou 18 {/* targeting-react-17-or-18* /}
7272
73- For React 17 and React 18 projects, you need two steps :
73+ Para projetos React 17 e React 18, você precisa de duas etapas :
7474
75- 1 . Install the runtime package :
75+ 1 . Instale o pacote de runtime :
7676
7777``` bash
7878npm install react-compiler-runtime@latest
7979```
8080
81- 2 . Configure the target :
81+ 2 . Configure o destino :
8282
8383``` js
84- // For React 18
84+ // Para React 18
8585{
8686 target: ' 18'
8787}
8888
89- // For React 17
89+ // Para React 17
9090{
9191 target: ' 17'
9292}
9393```
9494
95- The compiler will use the polyfill runtime for both versions :
95+ O compilador usará o runtime de polyfill para ambas as versões :
9696
9797``` js
98- // Compiled output uses the polyfill
98+ // A saída compilada usa o polyfill
9999import { c as _c } from ' react-compiler-runtime' ;
100100```
101101
102102---
103103
104- ## Troubleshooting {/* troubleshooting* /}
104+ ## Solução de Problemas {/* troubleshooting* /}
105105
106- ### Runtime errors about missing compiler runtime {/* missing-runtime* /}
106+ ### Erros de runtime sobre runtime do compilador ausente {/* missing-runtime* /}
107107
108- If you see errors like "Cannot find module 'react/compiler-runtime'":
108+ Se você vir erros como "Cannot find module 'react/compiler-runtime'":
109109
110- 1 . Check your React version :
110+ 1 . Verifique sua versão do React :
111111 ``` bash
112112 npm why react
113113 ```
114114
115- 2 . If using React 17 or 18, install the runtime:
115+ 2 . Se estiver usando React 17 ou 18, instale o runtime:
116116 ``` bash
117117 npm install react-compiler-runtime@latest
118118 ```
119119
120- 3 . Ensure your target matches your React version :
120+ 3 . Certifique-se de que seu ` target ` corresponda à sua versão do React :
121121 ``` js
122122 {
123- target: ' 18' // Must match your React major version
123+ target: ' 18' // Deve corresponder à sua versão principal do React
124124 }
125125 ```
126126
127- ### Runtime package not working {/* runtime-not-working* /}
127+ ### Pacote de runtime não funcionando {/* runtime-not-working* /}
128128
129- Ensure the runtime package is :
129+ Certifique-se de que o pacote de runtime esteja :
130130
131- 1 . Installed in your project (not globally )
132- 2 . Listed in your ` package.json ` dependencies
133- 3 . The correct version ( ` @latest ` tag )
134- 4 . Not in ` devDependencies ` (it's needed at runtime )
131+ 1 . Instalado em seu projeto (não globalmente )
132+ 2 . Listado nas dependências do seu ` package.json `
133+ 3 . A versão correta (tag ` @latest ` )
134+ 4 . Não em ` devDependencies ` (é necessário em tempo de execução )
135135
136- ### Checking compiled output {/* checking-output* /}
136+ ### Verificando a saída compilada {/* checking-output* /}
137137
138- To verify the correct runtime is being used, note the different import (` react/compiler-runtime ` for builtin, ` react-compiler-runtime ` standalone package for 17/18):
138+ Para verificar se o runtime correto está sendo usado, observe a importação diferente (` react/compiler-runtime ` para integrado, pacote ` react-compiler-runtime ` autônomo para 17/18):
139139
140140``` js
141- // For React 19 (built-in runtime)
141+ // Para React 19 (runtime integrado )
142142import { c } from ' react/compiler-runtime'
143143// ^
144144
145- // For React 17/18 (polyfill runtime)
145+ // Para React 17/18 (runtime polyfill )
146146import { c } from ' react-compiler-runtime'
147147// ^
148- ```
148+ ```
0 commit comments