Barrel Bypass
Finds barrel files (an index.ts that only re-exports) and rewrites imports to skip them, in one click.
- Barrel Files sidebar: every barrel, what it exports and where each name really comes from, who imports it, and cycles
- A hint on each import that goes through a barrel, with a quick fix: "Import X directly, bypassing the barrel"
- Bypass Barrels in This File, in a barrel's importers, or in the Workspace (asks first)
- Delete a barrel once nothing imports it
The rewrite follows export *, export { a as b }, export * as ns, default re-exports and chains of barrels. Aliases, type modifiers, quote style and semicolons are kept, and long imports are wrapped. Edits stay unsaved so you can review or undo them.
Imports come out relative, even if they used a tsconfig alias. The exception is SvelteKit $lib, which stays $lib/.... Names that cannot be traced stay on the barrel. tsconfig.json paths, baseUrl and extends are read from each workspace folder.
Settings
| Setting |
Purpose |
barrel.diagnostics |
Hint and quick fix on imports through a barrel. |
barrel.exclude |
Globs to leave out of the index. |
barrel.maxFiles |
Most files to index (5000). |
Imports inside .svelte and .vue <script> blocks are read and rewritten, and barrels can re-export components (export { default as Box } from "./Box.svelte"). $lib resolves to src/lib of the nearest folder with a svelte.config.
Not covered yet: require(), and path aliases that are not in tsconfig.json (including SvelteKit kit.alias).