1.0.2 • Published 7 years ago

create-barrel-file v1.0.2

Weekly downloads
2
License
ISC
Repository
-
Last release
7 years ago

Create Barrel File

What's a barrel file?

A barrel file is an index.js that exports everything from a directory. This allows us to import named exports directly from that directory instead of referencing the filename.

A simple barrel file located in the src/components directory.

export * from './Container'
export * from './Counter'
export * from './Home'

Now, instead of importing modules based on their specific filenames, we can instead import everything we need in one statement.

A simple usage file located in the src directory.

import { Container, Counter, Home } from './components'

Install

npm install -g create-barrel-file

Create a Barrel file

Make sure your terminal/command prompt's current directory is the directory where the barrel file should be created. Then enter the following command.

create-barrel-file
1.0.2

7 years ago

1.0.1

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

1.0.0

7 years ago