Skip to content

Commit e2639ac

Browse files
committed
Turbopack: Improve the description on InvalidLoaderRuleConditionIssue
1 parent fd9eb28 commit e2639ac

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

crates/next-core/src/next_config.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,7 @@ impl Issue for InvalidLoaderRuleRenameAsIssue {
12851285

12861286
#[turbo_tasks::value(shared)]
12871287
struct InvalidLoaderRuleConditionIssue {
1288+
error_string: RcStr,
12881289
condition: ConfigConditionItem,
12891290
config_file_path: FileSystemPath,
12901291
}
@@ -1309,7 +1310,15 @@ impl Issue for InvalidLoaderRuleConditionIssue {
13091310
#[turbo_tasks::function]
13101311
async fn description(&self) -> Result<Vc<OptionStyledString>> {
13111312
Ok(Vc::cell(Some(
1312-
StyledString::Text(RcStr::from(format!("{:#?}", self.condition))).resolved_cell(),
1313+
StyledString::Stack(vec![
1314+
StyledString::Line(vec![
1315+
StyledString::Text(rcstr!("Encountered the following error:")),
1316+
StyledString::Code(self.error_string.clone()),
1317+
]),
1318+
StyledString::Text(rcstr!("While processing the condition:")),
1319+
StyledString::Code(RcStr::from(format!("{:#?}", self.condition))),
1320+
])
1321+
.resolved_cell(),
13131322
)))
13141323
}
13151324

examples/basic-css/next.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
turbopack: {
3+
rules: {
4+
"*.svg": {
5+
loaders: ["@svgr/webpack"],
6+
as: "*.js",
7+
condition: {
8+
path: /abc/,
9+
},
10+
},
11+
},
12+
},
13+
};

0 commit comments

Comments
 (0)