Auto Barrel Generator
Automatically generates and keeps Stop manually writing exports. 🎬 Demo
✨ Features
📦 What It GeneratesNamed exports only
Default export only
Default + named exports
📁 ExampleBefore
After
📥 Installation
🚀 How It WorksThe extension watches your workspace and regenerates the barrel file automatically when needed. No manual trigger required. You can also manually generate a barrel file:
⚙️ ConfigurationConfigure behavior in VS Code settings:
Configure via
|
| Setting | Type | Description |
|---|---|---|
outputFile |
string | auto, index.ts, or index.js |
includeSubfolders |
boolean | Include files from nested directories |
skipRootAndSrc |
boolean | Skip auto generation in workspace root and src |
sortAlphabetically |
boolean | Sort exports alphabetically |
ignore |
string[] | Folder names to ignore |
🧠 Smart Export Detection
This extension parses your files using the TypeScript compiler API (AST) to detect:
export defaultexport constexport functionexport classexport interfaceexport typeexport { X }- CommonJS exports (
module.exports,exports.foo,module.exports.foo)
Files without exports are automatically ignored.
🎯 Why Use It?
- Avoid manual barrel maintenance
- Prevent missing exports
- Improve developer experience
- Keep folder structure clean
- Scale better in large projects
⚡ Performance
- Lightweight
- Event-based file watching
- No background polling
- Only regenerates when necessary
⚠️ Limitations
- Source files named
index.ts,index.tsx,index.js, andindex.jsxare ignored to avoid self-reexports/cycles. - If a folder only contains
index.*, no barrel is generated automatically. - Recommended pattern: use files like
router.tsxorroutes.tsxas sources, and keepindex.tsfor the generated barrel.
🛠 Requirements
- VS Code 1.75+
- Node.js project
🗺 Roadmap
- Exclude patterns (glob support)
- Marketplace publishing
📄 License
MIT © 2026 Mariano Hilario
👨💻 Author
Mariano Hilario
GitHub: https://github.com/marianohilario
Built to simplify barrel management in modern JavaScript and TypeScript projects.