Commit 72c775c9 authored by Benjamin Woodruff's avatar Benjamin Woodruff

Draft: Port #84070 (react compiler anonymous function naming) to Rust

parent b8531670
...@@ -772,6 +772,8 @@ pub struct ReactCompilerOptions { ...@@ -772,6 +772,8 @@ pub struct ReactCompilerOptions {
pub compilation_mode: ReactCompilerCompilationMode, pub compilation_mode: ReactCompilerCompilationMode,
#[serde(default)] #[serde(default)]
pub panic_threshold: ReactCompilerPanicThreshold, pub panic_threshold: ReactCompilerPanicThreshold,
#[serde(default)]
pub enable_name_anonymous_functions: Option<bool>,
} }
#[derive( #[derive(
......
...@@ -149,11 +149,16 @@ pub async fn get_babel_loader_rules( ...@@ -149,11 +149,16 @@ pub async fn get_babel_loader_rules(
&& let Some(babel_plugin_path) = && let Some(babel_plugin_path) =
resolve_babel_plugin_react_compiler(next_config, project_path).await? resolve_babel_plugin_react_compiler(next_config, project_path).await?
{ {
let react_compiler_options = react_compiler_options.await?; let mut react_compiler_options = react_compiler_options.owned().await?;
react_compiler_options
.enable_name_anonymous_functions
.get_or_insert_with(|| {
builtin_conditions.contains(&WebpackLoaderBuiltinCondition::Development)
});
let react_compiler_plugins = let react_compiler_plugins =
serde_json::Value::Array(vec![serde_json::Value::Array(vec![ serde_json::Value::Array(vec![serde_json::Value::Array(vec![
serde_json::Value::String(babel_plugin_path.into_owned()), serde_json::Value::String(babel_plugin_path.into_owned()),
serde_json::to_value(&*react_compiler_options) serde_json::to_value(&react_compiler_options)
.expect("react compiler options JSON serialization should never fail"), .expect("react compiler options JSON serialization should never fail"),
])]); ])]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment