Skip to content

Commit

Permalink
refactor(turbopack): deprecate single react_refresh options (#4949)
Browse files Browse the repository at this point in the history
### Description

closes WEB-1049.

vercel/next.js#49822 removes usage of the option
itself, instead using jsxoptions.
  • Loading branch information
kwonoj committed May 15, 2023
1 parent ea3c451 commit 3dd1dac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
11 changes: 9 additions & 2 deletions crates/turbopack-cli/src/dev/web_entry_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,17 @@ async fn get_client_module_options_context(
.await?
.is_found();

let enable_jsx = Some(
JsxTransformOptions {
react_refresh: enable_react_refresh,
..Default::default()
}
.cell(),
);

let module_options_context = ModuleOptionsContext {
enable_jsx: Some(JsxTransformOptions::default().cell()),
enable_jsx,
enable_emotion: Some(EmotionTransformConfigVc::default()),
enable_react_refresh,
enable_styled_components: Some(StyledComponentsTransformConfigVc::default()),
enable_styled_jsx: true,
enable_postcss_transform: Some(Default::default()),
Expand Down
3 changes: 1 addition & 2 deletions crates/turbopack/src/module_options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ impl ModuleOptionsVc {
) -> Result<ModuleOptionsVc> {
let ModuleOptionsContext {
enable_jsx,
enable_react_refresh,
enable_styled_jsx,
ref enable_styled_components,
enable_types,
Expand Down Expand Up @@ -139,7 +138,7 @@ impl ModuleOptionsVc {
let jsx = enable_jsx.await?;

transforms.push(EcmascriptInputTransform::React {
refresh: enable_react_refresh || jsx.react_refresh,
refresh: jsx.react_refresh,
import_source: OptionStringVc::cell(jsx.import_source.clone()),
runtime: OptionStringVc::cell(jsx.runtime.clone()),
});
Expand Down
2 changes: 0 additions & 2 deletions crates/turbopack/src/module_options/module_options_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ pub struct ModuleOptionsContext {
#[serde(default)]
pub enable_emotion: Option<EmotionTransformConfigVc>,
#[serde(default)]
pub enable_react_refresh: bool,
#[serde(default)]
pub enable_styled_components: Option<StyledComponentsTransformConfigVc>,
#[serde(default)]
pub enable_styled_jsx: bool,
Expand Down

0 comments on commit 3dd1dac

Please sign in to comment.