Unverified Commit 34647db2 authored by Andrew Imm's avatar Andrew Imm Committed by GitHub

Turbopack: add webpack loader names to traces (#87230)

When examining the long trace this morning, it wasn't immediately clear
what was running in the shell-out to Node.
This doesn't fully fix the issue, but it makes it clearer which webpack
loader is running, similar to how the PostCSS loader lists the name of
the css file it's parsing.

In this trace, the next config contains:
```
  turbopack: {
    rules: {
      "**/*.{js,jsx,ts,tsx}": {
        loaders: ["./loader_test.js"],
      },
    },
  },
```

And the trace renders as:

<img width="995" height="553" alt="Screenshot 2025-12-15 at 11 22 39 PM"
src="https://github.com/user-attachments/assets/b0936e2e-f9d5-45fc-8a1c-2f98b1aa38b6"
/>
parent 299e1ff3
...@@ -67,3 +67,18 @@ impl TaskInput for ResolvedWebpackLoaderItem { ...@@ -67,3 +67,18 @@ impl TaskInput for ResolvedWebpackLoaderItem {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[turbo_tasks::value(shared, transparent)] #[turbo_tasks::value(shared, transparent)]
pub struct WebpackLoaderItems(pub Vec<WebpackLoaderItem>); pub struct WebpackLoaderItems(pub Vec<WebpackLoaderItem>);
impl std::fmt::Display for WebpackLoaderItems {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut iter = self.0.iter();
if let Some(first) = iter.next() {
write!(f, "{}", first.loader)?;
for remaining in iter {
write!(f, ", {}", remaining.loader)?;
}
}
Ok(())
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment