Sha256: 5c71d0b3841b668697cea30d8ad369a695e54add095cee40fdd8db3e37d27013

Contents?: true

Size: 1.04 KB

Versions: 54

Compression:

Stored size: 1.04 KB

Contents

# 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

Version data entries

54 entries across 42 versions & 16 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/require-main-filename/README.md
optimacms-0.1.61 spec/dummy/node_modules/yargs/node_modules/require-main-filename/README.md
disco_app-0.18.0 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.18.0 test/dummy/node_modules/webpack-cli/node_modules/require-main-filename/README.md
disco_app-0.18.2 test/dummy/node_modules/webpack-cli/node_modules/require-main-filename/README.md
disco_app-0.18.2 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.16.1 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.15.2 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.18.4 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.18.1 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.14.0 test/dummy/node_modules/require-main-filename/README.md
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/require-main-filename/README.md
tang-0.2.1 spec/tang_app/node_modules/require-main-filename/README.md
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/require-main-filename/README.md
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/require-main-filename/README.md
ruby2js-4.0.4 lib/tasks/testrails/node_modules/require-main-filename/README.md
ruby2js-4.0.3 lib/tasks/testrails/node_modules/require-main-filename/README.md
tang-0.2.0 spec/tang_app/node_modules/require-main-filename/README.md
tang-0.1.0 spec/tang_app/node_modules/require-main-filename/README.md