Commit Graph

4 Commits

Author SHA1 Message Date
Luke Sandberg 19e8e3c3c2 Revert "Revert "[turbopack] Compute Import Traces for Issues"" (#80220)
Reverts vercel/next.js#80215 which was a revert of vercel/next.js#79351

Closes PACK-4105
2025-06-07 15:28:07 -07:00
Luke Sandberg 0d2e80554a Revert "[turbopack] Compute Import Traces for Issues" (#80215)
Reverts vercel/next.js#79351

See https://github.com/vercel/next.js/actions/runs/15474422003/job/43570614813#step:34:1556
2025-06-05 13:44:39 -07:00
Luke Sandberg 7a66008cae [turbopack] Compute Import Traces for Issues (#79351)
When turbopack reports an issue, compute a set of import-traces for that file so the user can better understand the context of the issue and trivially answer questions like:

* Why is this file included at all?
* Why does next think this is a client-component?

To do this we leverage the `SingleModuleGraph` and use the `astar` algorithm from `petgraph` to compute the shortest path to a root module.  This isn't the most optimal approach but should be sufficient since we don't anticipate this being a performance issue.

A complex part of this is that the module-graph tracks the relationships between _modules_ but Issues are associated with _files_.  While modules are also associated with files this is a many-to-one relationship.  This is why we might report _multiple_ traces for a single issue and also why a single file might appear multiple times in a trace.

## Open formatting questions

* how should we represent paths from other 'filesystems'?
    - for disk filesystems i could compute relative paths to the root of the current directory? the `[project]` filesystem?  For now i just use the filesystem name as a hypothetically cromulent root.


## Alternatives

The main alternative investigated was associating  Issues with `Modules` by collecting them during graph construction. This unfortunately proved to be a non-trivial performance regression and so it was abandoned.  The core problem is that we would need to introduce additional `OperationVc` and task roots to simply `collect` the issues.  This also wouldn't eliminate the duplicate traces issue, and instead we might end up reporting duplicate issues instead.

## Performance
TODO

Closes PACK-4105
2025-06-05 11:21:11 -07:00
Will Binns-Smith 61a0f09c59 Turbopack: Don’t show stack traces for internal modules (#64228)
See
https://github.com/vercel/next.js/blob/ac7607f9775ea97bcb7f01f9da148d8c51abcc42/packages/next/src/client/components/react-dev-overlay/server/shared.ts#L59-L62.

Test Plan: Added an e2e test.


Closes PACK-2919
2024-04-18 16:56:24 -07:00