📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

@chatterbug/babel-plugin-directory-named

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chatterbug/babel-plugin-directory-named

Babel plugin directory named modules

1.2.0
latest
Source
npm
Version published
Weekly downloads
7
600%
Maintainers
3
Weekly downloads
 
Created
Source

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)
      }
    ]
  ]
}

Keywords

babel

FAQs

Package last updated on 27 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts