next.js
326fc900 - [turbopack] Track re-exports in `import_usage` inside of `compute_import_usage` (#95989)

Commit
23 days ago
[turbopack] Track re-exports in `import_usage` inside of `compute_import_usage` (#95989) Previously, code such as: ``` export { foo } from "bar" ``` Would contribute to a module's exports (we export foo). However, it would not contribute to our tracking of imports from "bar". Therefore we would fall back to the default import usage: https://github.com/vercel/next.js/blob/c0a7b91becb33490bf412d02bbf09ebaa7216083/turbopack/crates/turbopack-ecmascript/src/references/exports.rs#L140 ```rust pub enum ImportUsage { #[default] TopLevel, Exports(FrozenSet<RcStr>), } ``` We would therefore not tree-shake. This is rarely a problem with normal imports / exports because they support following reexports and this is enabled by default in Turbopack. However, async imports do not support following reexports. In https://github.com/vercel/next.js/issues/95698, the import of the Viem chain definitions is an async-imported module: <img width="796" height="81" alt="Screenshot 2026-07-20 at 5 47 43 pm" src="https://github.com/user-attachments/assets/2fc46711-469f-4f28-8369-9c1ea01b808d" /> Closes https://github.com/vercel/next.js/issues/95698 I looked at the reproduction from the original issue, and this was the result: ``` Client graph contains 11/712 viem chain definition files. Not reproduced; missing 701 definitions. ``` Yay!
Author
Parents
Loading