Add React Compiler memoization preservation option - #98589
Conversation
Failing CI jobsCommit: b3eb58f | About building and testing Next.js |
c3a6d80 to
06f9709
Compare
| base: ReactCompilerOptionsWithoutEnvironment { | ||
| compilation_mode: react_compiler_options_with_target.compilation_mode, | ||
| panic_threshold: &react_compiler_options_with_target.panic_threshold, | ||
| target: react_compiler_options_with_target.target, | ||
| }, |
There was a problem hiding this comment.
is there a From implementation that could make this a little nicer
| ], | ||
| [undefined, { enableNameAnonymousFunctions: false }], | ||
| ])( | ||
| 'forwards the Babel environment option when configured as %s', |
There was a problem hiding this comment.
Nit: This test seems complicated and doesn't seem all that useful. If we really want more coverage we could extend one of our existing e2e tests that writes code that depends on this feature? But also, I don't think we need the coverage here.
| ); | ||
| } | ||
|
|
||
| use super::*; |
There was a problem hiding this comment.
Just move this use up to the top of the test block, and don't add more use super::...s.
IMO use super::* is fine for test blocks. It's not okay anywhere else, but in tests it's idiomatic.
| const environment: Pick<EnvironmentConfig, 'enableNameAnonymousFunctions'> & | ||
| Partial< | ||
| Pick<EnvironmentConfig, 'enablePreserveExistingMemoizationGuarantees'> | ||
| > = { |
There was a problem hiding this comment.
Can we do some sort of simpler type like this? This is just a temporary value that we end up shoving into an untyped JSONValue on the next line.
| const environment: Pick<EnvironmentConfig, 'enableNameAnonymousFunctions'> & | |
| Partial< | |
| Pick<EnvironmentConfig, 'enablePreserveExistingMemoizationGuarantees'> | |
| > = { | |
| const environment: Partial<EnvironmentConfig> = { |
06f9709 to
b3eb58f
Compare
| @@ -0,0 +1,63 @@ | |||
| import { configSchema } from '../../packages/next/src/server/config-schema' | |||
b3eb58f to
29ded58
Compare
Summary
Add
reactCompiler.enablePreserveExistingMemoizationGuaranteesand forward it through the Babel and experimental Turbopack Rust compiler paths. Omitted values preserve each compiler implementation's default.Add focused schema, Babel, and Rust tests and document the option.
Verification
pnpm --filter=next typescargo check -p turbopack-ecmascript -p turbopack -p next-corecargo test -p turbopack-ecmascript react_compiler_testscargo test -p next-core next_configenablePreserveExistingMemoizationGuarantees: false