require-relative-main

1.1.6 • Public • Published

require-relative-main Build Status

require a module relative to the "main" script

Install

$ npm install --save require-relative-main

Usage

var requireRelativeMain = require('require-relative-main');
 
requireRelativeMain('./foo', __dirname);

API

requireRelativeMain(modulePath, [cwd]) -> any

modulePath

Required
Type: string

The path to the module to be required. This will be required relative to the "main" entry for the package.

cwd

Type: string
Default: process.cwd()

The working directory from which to look upwards for the package.json file that specifies the main script. You should typically specify __dirname.

Browserify

Use the mainify transform in your package if you plan to use require-relative-main with Browserify.

License

MIT © Ben Drucker

Readme

Keywords

Package Sidebar

Install

npm i require-relative-main

Weekly Downloads

3

Version

1.1.6

License

MIT

Last publish

Collaborators

  • bendrucker