1.0.2 • Published 8 years ago

create-barrel-file v1.0.2

Weekly downloads
2
License
ISC
Repository
-
Last release
8 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

8 years ago

1.0.1

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

1.0.0

8 years ago