# @elastic/webpack-directory-name-as-main

> Teach webpack to use the name of the directory as the main file for a module

Latest version **2.0.3** (published 2017-04-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @elastic/webpack-directory-name-as-main
pnpm add @elastic/webpack-directory-name-as-main
yarn add @elastic/webpack-directory-name-as-main
bun add @elastic/webpack-directory-name-as-main
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2017-04-25 |
| First published | 2016-12-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Spencer Alger |
| Maintainers | bargs, ccowan, cjcenizal, courtewing, edwardsy, jbudz, kimjoar, lukasolson, spalger, thomasneirynck, tylersmalley, w33ble, ycombinator |
| Keywords | webpack, module, main |

## Links

- npm: https://www.npmjs.com/package/@elastic/webpack-directory-name-as-main
- Repository: https://github.com/spalger/webpack-directory-name-as-main
- Homepage: https://github.com/spalger/webpack-directory-name-as-main#readme
- Issues: https://github.com/spalger/webpack-directory-name-as-main/issues
- npm.io page: https://npm.io/package/@elastic/webpack-directory-name-as-main

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2017-04-25
- 2.0.2 — 2016-12-21
- 2.0.1 — 2016-12-21
- 2.0.0 — 2016-12-21

## README

# @elastic/webpack-directory-name-as-main

Teach webpack to use a file with the same name as the directory if that directory is required and it doesn't have an index.js file.

This allows you to write:

`require('lib/ReallyImportantModule')`

inorder to require:

`lib/ReallyImportantModule/ReallyImportantModule.js`


This module is designed to be used as strategy for a `webpack.ResolverPlugin` like so:
```js
var DirectoryNameAsMain = require('@elastic/webpack-directory-name-as-main');
var webpackConfig = {
  entry: ...,

  plugins: [
    new webpack.ResolverPlugin([
      new DirectoryNameAsMain()
    ]),
    ...
  ]
};
```

---
_Source: https://npm.io/package/@elastic/webpack-directory-name-as-main · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
