@@ -1283,6 +1283,7 @@ impl Issue for InvalidLoaderRuleRenameAsIssue {
12831283
12841284#[ turbo_tasks:: value( shared) ]
12851285struct InvalidLoaderRuleConditionIssue {
1286+ error_string : RcStr ,
12861287 condition : ConfigConditionItem ,
12871288 config_file_path : FileSystemPath ,
12881289}
@@ -1307,7 +1308,15 @@ impl Issue for InvalidLoaderRuleConditionIssue {
13071308 #[ turbo_tasks:: function]
13081309 async fn description ( & self ) -> Result < Vc < OptionStyledString > > {
13091310 Ok ( Vc :: cell ( Some (
1310- StyledString :: Text ( RcStr :: from ( format ! ( "{:#?}" , self . condition) ) ) . resolved_cell ( ) ,
1311+ StyledString :: Stack ( vec ! [
1312+ StyledString :: Line ( vec![
1313+ StyledString :: Text ( rcstr!( "Encountered the following error: " ) ) ,
1314+ StyledString :: Code ( self . error_string. clone( ) ) ,
1315+ ] ) ,
1316+ StyledString :: Text ( rcstr!( "While processing the condition:" ) ) ,
1317+ StyledString :: Code ( RcStr :: from( format!( "{:#?}" , self . condition) ) ) ,
1318+ ] )
1319+ . resolved_cell ( ) ,
13111320 ) ) )
13121321 }
13131322
@@ -1497,19 +1506,21 @@ impl NextConfig {
14971506 // convert from Next.js-specific condition type to internal Turbopack
14981507 // condition type
14991508 let condition = if let Some ( condition) = condition {
1500- if let Ok ( cond) = ConditionItem :: try_from ( condition. clone ( ) ) {
1501- Some ( cond)
1502- } else {
1503- InvalidLoaderRuleConditionIssue {
1504- condition : condition. clone ( ) ,
1505- config_file_path : self
1506- . config_file_path ( project_path. clone ( ) )
1507- . owned ( )
1508- . await ?,
1509+ match ConditionItem :: try_from ( condition. clone ( ) ) {
1510+ Ok ( cond) => Some ( cond) ,
1511+ Err ( err) => {
1512+ InvalidLoaderRuleConditionIssue {
1513+ error_string : RcStr :: from ( err. to_string ( ) ) ,
1514+ condition : condition. clone ( ) ,
1515+ config_file_path : self
1516+ . config_file_path ( project_path. clone ( ) )
1517+ . owned ( )
1518+ . await ?,
1519+ }
1520+ . resolved_cell ( )
1521+ . emit ( ) ;
1522+ None
15091523 }
1510- . resolved_cell ( )
1511- . emit ( ) ;
1512- None
15131524 }
15141525 } else {
15151526 None
0 commit comments