Latest Results
feat(experimental/lazy-barrel): advice on oversized barrel modules (#9236)
## Summary
Adds a build-time advisory when the experimental `lazyBarrel` flag is enabled and a barrel module exceeds **5000 re-exports** (think large icon packs like `lucide-react` or `@mui/icons-material`). Eagerly resolving every re-export in such a barrel is a known bottleneck, so rolldown now points users at [`@rolldown/plugin-transform-imports`](https://github.com/rolldown/plugins/tree/main/packages/transform-imports), which rewrites imports at the source so the barrel file is never loaded.
Example output:
```
advice[LARGE_BARREL_MODULES]: node_modules/lucide-react/dist/esm/lucide-react.js has 1463 re-exports. Eagerly resolving every entry can significantly slow down the build. Consider using `@rolldown/plugin-transform-imports` to rewrite imports at the source level so the barrel file is never loaded.
help: See https://github.com/rolldown/plugins/tree/main/packages/transform-imports for usage.
```
## What's in this PR
- **New diagnostic event `LargeBarrelModules`** (`EventKind = 46`) under `rolldown_error`, with a dedicated `BuildEvent` impl that formats the module id, re-export count, and a help link.
- **`Severity::Info` variant** on `BuildDiagnostic`, rendered as `ReportKind::Advice` via ariadne (distinct from the existing `error:` / `warning:` prefixes). A `with_severity()` builder is added so the same diagnostic can be downgraded to an info-level log.
- **Detection in `module_task.rs`**: after lazy-barrel info is computed, if the resolved barrel has more than 5000 import records, an `Info`-level `Log` is dispatched through `on_log` with `code = "LARGE_BARREL_MODULES"`. Gated on the new check flag so users can silence it.
- **New check flag** `checks.largeBarrelModules` (default `true`), propagated through the usual codegen: Rust `EventKindSwitcher`, NAPI binding, TS `ChecksOptions`, validator, JSON schema, and CLI `--checks.large-barrel-modules`.
## How to opt out
```js
export default {
experimental: { lazyBarrel: true },
checks: { largeBarrelModules: false },
}
```
Or from the CLI:
```sh
rolldown --no-checks.large-barrel-modules
```
## Notes on the threshold
5000 was chosen so that ordinary component or utility barrels (typically in the low hundreds) stay quiet, and only the real outliers (icon packs, mass re-export shims) trip it. The threshold is intentionally not user-configurable for now; once we have real-world feedback it can be promoted to an option.
<img width="710" height="119" alt="image" src="https://github.com/user-attachments/assets/45b73c26-0294-45dc-b2d0-f25627eaed5e" /> Latest Branches
0%
Kyujenius:feat/warn-invalid-pure-annotations 0%
0%
04-27-feat_lazy-barrel_warn_on_oversized_barrel_modules © 2026 CodSpeed Technology