# require-module-main

> ## 20180317Sat

Latest version **0.1.0** (published 2018-03-19) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-03-19 |
| First published | 2018-03-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 118.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | vjpr |

## Links

- npm: https://www.npmjs.com/package/require-module-main
- npm.io page: https://npm.io/package/require-module-main

## Dependencies (12)

- [chalk](https://npm.io/package/chalk.md) ^2.3.2
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [pkg-dir](https://npm.io/package/pkg-dir.md) ^2.0.0
- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^3.0.0
- [resolve-pkg](https://npm.io/package/resolve-pkg.md) ^1.0.0
- [resolve-from](https://npm.io/package/resolve-from.md) ^4.0.0
- [builtin-modules](https://npm.io/package/builtin-modules.md) ^2.0.0
- [is-relative-path](https://npm.io/package/is-relative-path.md) ^2.0.0
- [is-builtin-module](https://npm.io/package/is-builtin-module.md) ^2.0.0
- [parse-package-name](https://npm.io/package/parse-package-name.md) ^0.1.0
- [lodash.defaultsdeep](https://npm.io/package/lodash.defaultsdeep.md) ^4.6.0
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.24.1

## Recent versions

- 0.1.0 (latest) — 2018-03-19

## README

# Status

##  20180317Sat

Works. But I stopped to investigate whether `esm` will solve my problems...

---

Override `Module._findPath`.

We just have to find the case when there is a `package.json`. Then defer to original function.

---

```js
// Need to allow some node_modules to be transpiled by babel-register when using `import-main`.
// Maybe we should make a wrapper called `babel-register-modules` to take care of this... 
require('babel-register')({include: ['node_modules/foo']})
require('import-main')({include: ['node_modules/foo']}
```

# Reference

- https://github.com/dherman/defense-of-dot-js/blob/master/proposal.md#detailed-lookup-rules
- http://2ality.com/2017/04/setting-up-multi-platform-packages.html
- http://2ality.com/2017/07/npm-packages-via-babel.html

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