@@ -21,9 +21,7 @@ use turbopack_core::{
21
21
} ,
22
22
compile_time_defines,
23
23
compile_time_info:: { CompileTimeDefines , CompileTimeInfo , FreeVarReferences } ,
24
- environment:: {
25
- BrowserEnvironment , Environment , ExecutionEnvironment , NodeJsEnvironment , NodeJsVersion ,
26
- } ,
24
+ environment:: { Environment , ExecutionEnvironment , NodeJsEnvironment , NodeJsVersion } ,
27
25
free_var_references,
28
26
module_graph:: export_usage:: OptionExportUsageInfo ,
29
27
target:: CompileTarget ,
@@ -371,28 +369,16 @@ pub async fn get_server_compile_time_info(
371
369
cwd : RcStr ,
372
370
define_env : Vc < OptionEnvMap > ,
373
371
node_version : ResolvedVc < NodeJsVersion > ,
374
- css_browserslist_query : RcStr ,
375
372
) -> Result < Vc < CompileTimeInfo > > {
376
- let css_environment = BrowserEnvironment {
377
- dom : false ,
378
- web_worker : false ,
379
- service_worker : false ,
380
- browserslist_query : css_browserslist_query,
381
- }
382
- . resolved_cell ( ) ;
383
-
384
373
CompileTimeInfo :: builder (
385
- Environment :: new (
386
- ExecutionEnvironment :: NodeJsLambda (
387
- NodeJsEnvironment {
388
- compile_target : CompileTarget :: current ( ) . to_resolved ( ) . await ?,
389
- node_version,
390
- cwd : ResolvedVc :: cell ( Some ( cwd) ) ,
391
- }
392
- . resolved_cell ( ) ,
393
- ) ,
394
- * css_environment,
395
- )
374
+ Environment :: new ( ExecutionEnvironment :: NodeJsLambda (
375
+ NodeJsEnvironment {
376
+ compile_target : CompileTarget :: current ( ) . to_resolved ( ) . await ?,
377
+ node_version,
378
+ cwd : ResolvedVc :: cell ( Some ( cwd) ) ,
379
+ }
380
+ . resolved_cell ( ) ,
381
+ ) )
396
382
. to_resolved ( )
397
383
. await ?,
398
384
)
@@ -405,10 +391,9 @@ pub async fn get_server_compile_time_info(
405
391
#[ turbo_tasks:: function]
406
392
pub async fn get_tracing_compile_time_info ( ) -> Result < Vc < CompileTimeInfo > > {
407
393
CompileTimeInfo :: builder (
408
- Environment :: new (
409
- ExecutionEnvironment :: NodeJsLambda ( NodeJsEnvironment :: default ( ) . resolved_cell ( ) ) ,
410
- BrowserEnvironment :: default ( ) . cell ( ) ,
411
- )
394
+ Environment :: new ( ExecutionEnvironment :: NodeJsLambda (
395
+ NodeJsEnvironment :: default ( ) . resolved_cell ( ) ,
396
+ ) )
412
397
. to_resolved ( )
413
398
. await ?,
414
399
)
@@ -456,6 +441,7 @@ pub async fn get_server_module_options_context(
456
441
next_runtime : NextRuntime ,
457
442
encryption_key : ResolvedVc < RcStr > ,
458
443
environment : ResolvedVc < Environment > ,
444
+ client_environment : ResolvedVc < Environment > ,
459
445
) -> Result < Vc < ModuleOptionsContext > > {
460
446
let next_mode = mode. await ?;
461
447
let mut next_server_rules = get_next_server_transforms_rules (
@@ -525,7 +511,6 @@ pub async fn get_server_module_options_context(
525
511
let tree_shaking_mode_for_foreign_code = * next_config
526
512
. tree_shaking_mode_for_foreign_code ( next_mode. is_development ( ) )
527
513
. await ?;
528
- let css_versions = environment. css_runtime_versions ( ) ;
529
514
530
515
let tsconfig_path = next_config
531
516
. typescript_tsconfig_path ( )
@@ -586,8 +571,10 @@ pub async fn get_server_module_options_context(
586
571
// context type.
587
572
let styled_components_transform_rule =
588
573
get_styled_components_transform_rule ( next_config) . await ?;
574
+ // It's important the client's browserlist config is used for styled-jsx, otherwise we transpile
575
+ // the CSS to be compatible with Node.js 20.
589
576
let styled_jsx_transform_rule =
590
- get_styled_jsx_transform_rule ( next_config, css_versions ) . await ?;
577
+ get_styled_jsx_transform_rule ( next_config, client_environment . runtime_versions ( ) ) . await ?;
591
578
592
579
let source_maps = if * next_config. server_source_maps ( ) . await ? {
593
580
SourceMapsType :: Full
0 commit comments