Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
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

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
3
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