@chatterbug/babel-plugin-directory-named

1.2.0 • Public • Published

babel-plugin-directory-named

When you import from a folder it resolves to the index.js file in that folder.

import { magic } from './src/magic' // imports ./src/magic/index.js

This plugin allows you to name the entry file the same as the folder.

import { magic } from './src/magic' // imports ./src/magic/magic.js

Nice! Now you don't need to have a bajillion index.js file scattered around your project.

Quick start

Install the plugin first:

npm install --save-dev babel-plugin-directory-named
{
  "plugins": [
    [
      "babel-plugin-directory-named",
      {
        "rootDir": "./src"
        "honorIndex": true | false // (default: false)
      }
    ]
  ]
}

Package Sidebar

Install

npm i @chatterbug/babel-plugin-directory-named

Weekly Downloads

3

Version

1.2.0

License

MIT

Unpacked Size

7.09 kB

Total Files

3

Last publish

Collaborators

  • chatterbuild
  • juliarechkunova
  • florinlipan
  • jsierles
  • schacon