# require-main-filename

> shim for require.main.filename() that works in as many environments as possible

Latest version **2.0.0** (published 2019-01-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install require-main-filename
pnpm add require-main-filename
yarn add require-main-filename
bun add require-main-filename
```

## 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.0 |
| Published | 2019-01-28 |
| First published | 2016-02-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Ben Coe |
| Maintainers | bcoe |
| Keywords | require, shim, iisnode |

## Links

- npm: https://www.npmjs.com/package/require-main-filename
- Repository: https://github.com/yargs/require-main-filename
- Homepage: https://github.com/yargs/require-main-filename#readme
- Issues: https://github.com/yargs/require-main-filename/issues
- npm.io page: https://npm.io/package/require-main-filename

## Recent versions

- 2.0.0 (latest) — 2019-01-28
- 1.0.1 — 2016-02-17
- 1.0.0 — 2016-02-01

## README

# require-main-filename

[![Build Status](https://travis-ci.org/yargs/require-main-filename.png)](https://travis-ci.org/yargs/require-main-filename)
[![Coverage Status](https://coveralls.io/repos/yargs/require-main-filename/badge.svg?branch=master)](https://coveralls.io/r/yargs/require-main-filename?branch=master)
[![NPM version](https://img.shields.io/npm/v/require-main-filename.svg)](https://www.npmjs.com/package/require-main-filename)

`require.main.filename` is great for figuring out the entry
point for the current application. This can be combined with a module like
[pkg-conf](https://www.npmjs.com/package/pkg-conf) to, _as if by magic_, load
top-level configuration.

Unfortunately, `require.main.filename` sometimes fails when an application is
executed with an alternative process manager, e.g., [iisnode](https://github.com/tjanczuk/iisnode).

`require-main-filename` is a shim that addresses this problem.

## Usage

```js
var main = require('require-main-filename')()
// use main as an alternative to require.main.filename.
```

## License

ISC

---
_Source: https://npm.io/package/require-main-filename · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
