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
## Por que Enviar Código Compilado? {/*why-ship-compiled-code*/}
12
12
13
-
As a library author, you can compile your library code before publishing to npm. This provides several benefits:
13
+
Como autor de uma biblioteca, você pode compilar o código da sua biblioteca antes de publicá-lo no npm. Isso oferece vários benefícios:
14
14
15
-
-**Performance improvements for all users** - Your library users get optimized code even if they aren't using React Compiler yet
16
-
-**No configuration required by users** - The optimizations work out of the box
17
-
-**Consistent behavior** - All users get the same optimized version regardless of their build setup
15
+
-**Melhorias de performance para todos os usuários** - Seus usuários da biblioteca recebem código otimizado, mesmo que ainda não estejam usando o React Compiler.
16
+
-**Nenhuma configuração exigida pelos usuários** - As otimizações funcionam "out of the box".
17
+
-**Comportamento consistente** - Todos os usuários recebem a mesma versão otimizada, independentemente da configuração de build.
18
18
19
-
## Setting Up Compilation {/*setting-up-compilation*/}
19
+
## Configurando a Compilação {/*setting-up-compilation*/}
20
20
21
-
Add React Compiler to your library's build process:
21
+
Adicione o React Compiler ao processo de build da sua biblioteca:
22
22
23
23
<TerminalBlock>
24
24
npm install -D babel-plugin-react-compiler@latest
25
25
</TerminalBlock>
26
26
27
-
Configure your build tool to compile your library. For example, with Babel:
27
+
Configure sua ferramenta de build para compilar sua biblioteca. Por exemplo, com Babel:
### 2. Configure the target version {/*configure-target-version*/}
62
+
### 2. Configure a versão de destino {/*configure-target-version*/}
63
63
64
-
Set the minimum React version your library supports:
64
+
Defina a versão mínima do React que sua biblioteca suporta:
65
65
66
66
```js
67
67
{
68
-
target:'17', //Minimum supported React version
68
+
target:'17', //Versão mínima suportada do React
69
69
}
70
70
```
71
71
72
-
## Testing Strategy {/*testing-strategy*/}
72
+
## Estratégia de Testes {/*testing-strategy*/}
73
73
74
-
Test your library both with and without compilation to ensure compatibility. Run your existing test suite against the compiled code, and also create a separate test configuration that bypasses the compiler. This helps catch any issues that might arise from the compilation process and ensures your library works correctly in all scenarios.
74
+
Teste sua biblioteca com e sem compilação para garantir a compatibilidade. Execute sua suíte de testes existente contra o código compilado e também crie uma configuração de teste separada que ignore o compilador. Isso ajuda a capturar quaisquer problemas que possam surgir do processo de compilação e garante que sua biblioteca funcione corretamente em todos os cenários.
75
75
76
-
## Troubleshooting {/*troubleshooting*/}
76
+
## Solução de Problemas {/*troubleshooting*/}
77
77
78
-
### Library doesn't work with older React versions {/*library-doesnt-work-with-older-react-versions*/}
78
+
### A biblioteca não funciona com versões mais antigas do React {/*library-doesnt-work-with-older-react-versions*/}
79
79
80
-
If your compiled library throws errors in React 17 or 18:
80
+
Se sua biblioteca compilada gerar erros no React 17 ou 18:
81
81
82
-
1.Verify you've installed `react-compiler-runtime`as a dependency
83
-
2.Check that your `target`configuration matches your minimum supported React version
84
-
3.Ensure the runtime package is included in your published bundle
82
+
1.Verifique se você instalou `react-compiler-runtime`como uma dependência.
83
+
2.Verifique se sua configuração `target`corresponde à sua versão mínima suportada do React.
84
+
3.Certifique-se de que o pacote de runtime esteja incluído no seu bundle publicado.
85
85
86
-
### Compilation conflicts with other Babel plugins {/*compilation-conflicts-with-other-babel-plugins*/}
86
+
### Conflitos de compilação com outros plugins do Babel {/*compilation-conflicts-with-other-babel-plugins*/}
87
87
88
-
Some Babel plugins may conflict with React Compiler:
88
+
Alguns plugins do Babel podem entrar em conflito com o React Compiler:
89
89
90
-
1.Place`babel-plugin-react-compiler`early in your plugin list
91
-
2.Disable conflicting optimizations in other plugins
92
-
3.Test your build output thoroughly
90
+
1.Coloque`babel-plugin-react-compiler`no início da sua lista de plugins.
91
+
2.Desative otimizações conflitantes em outros plugins.
92
+
3.Teste minuciosamente a saída do seu build.
93
93
94
-
### Runtime module not found {/*runtime-module-not-found*/}
94
+
### Módulo de runtime não encontrado {/*runtime-module-not-found*/}
95
95
96
-
If users see "Cannot find module 'react-compiler-runtime'":
96
+
Se os usuários virem "Cannot find module 'react-compiler-runtime'":
97
97
98
-
1.Ensure the runtime is listed in`dependencies`, not `devDependencies`
99
-
2.Check that your bundler includes the runtime in the output
100
-
3.Verify the package is published to npm with your library
98
+
1.Certifique-se de que o runtime esteja listado em`dependencies`, não em `devDependencies`.
99
+
2.Verifique se seu bundler inclui o runtime na saída.
100
+
3.Verifique se o pacote foi publicado no npm junto com sua biblioteca.
101
101
102
-
## Next Steps {/*next-steps*/}
102
+
## Próximos Passos {/*next-steps*/}
103
103
104
-
-Learn about [debugging techniques](/learn/react-compiler/debugging)for compiled code
105
-
-Check the [configuration options](/reference/react-compiler/configuration)for all compiler options
0 commit comments