diff --git a/packages/next-swc/crates/next-core/src/next_client/context.rs b/packages/next-swc/crates/next-core/src/next_client/context.rs index f3eae07af24d9..797e182a2de89 100644 --- a/packages/next-swc/crates/next-core/src/next_client/context.rs +++ b/packages/next-swc/crates/next-core/src/next_client/context.rs @@ -27,7 +27,7 @@ use turbopack_binding::{ condition::ContextCondition, module_options::{ module_options_context::ModuleOptionsContext, JsxTransformOptions, ModuleRule, - TypescriptTransformOptions, + TypeofWindow, TypescriptTransformOptions, }, resolve_options_context::ResolveOptionsContext, }, @@ -270,6 +270,7 @@ pub async fn get_client_module_options_context( let enable_foreign_postcss_transform = Some(postcss_foreign_transform_options.cell()); let module_options_context = ModuleOptionsContext { + enable_typeof_window_inlining: Some(TypeofWindow::Object), preset_env_versions: Some(env), execution_context: Some(execution_context), tree_shaking_mode: Some(TreeShakingMode::ReexportsOnly), @@ -280,6 +281,7 @@ pub async fn get_client_module_options_context( // node_modules context let foreign_codes_options_context = ModuleOptionsContext { + enable_typeof_window_inlining: None, enable_webpack_loaders: foreign_enable_webpack_loaders, enable_postcss_transform: enable_foreign_postcss_transform, custom_rules: foreign_next_client_rules, diff --git a/packages/next-swc/crates/next-core/src/next_server/context.rs b/packages/next-swc/crates/next-core/src/next_server/context.rs index 8b2b45a7487c9..c934abde0daba 100644 --- a/packages/next-swc/crates/next-core/src/next_server/context.rs +++ b/packages/next-swc/crates/next-core/src/next_server/context.rs @@ -27,7 +27,8 @@ use turbopack_binding::{ turbopack::{ condition::ContextCondition, module_options::{ - JsxTransformOptions, ModuleOptionsContext, ModuleRule, TypescriptTransformOptions, + JsxTransformOptions, ModuleOptionsContext, ModuleRule, TypeofWindow, + TypescriptTransformOptions, }, resolve_options_context::ResolveOptionsContext, transition::Transition, @@ -461,6 +462,7 @@ pub async fn get_server_module_options_context( let styled_jsx_transform_rule = get_styled_jsx_transform_rule(next_config, versions).await?; let module_options_context = ModuleOptionsContext { + enable_typeof_window_inlining: Some(TypeofWindow::Undefined), execution_context: Some(execution_context), use_swc_css, tree_shaking_mode: Some(TreeShakingMode::ReexportsOnly), @@ -509,6 +511,7 @@ pub async fn get_server_module_options_context( }; let foreign_code_module_options_context = ModuleOptionsContext { + enable_typeof_window_inlining: None, custom_rules: foreign_next_server_rules.clone(), enable_webpack_loaders: foreign_enable_webpack_loaders, // NOTE(WEB-1016) PostCSS transforms should also apply to foreign code. @@ -563,6 +566,7 @@ pub async fn get_server_module_options_context( next_server_rules.extend(source_transform_rules); let foreign_code_module_options_context = ModuleOptionsContext { + enable_typeof_window_inlining: None, custom_rules: foreign_next_server_rules.clone(), enable_webpack_loaders: foreign_enable_webpack_loaders, // NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.