Require a module like `require()` but via a sequence of nested packages
npm i -S deep-require-from'use strict'
const deepRequireFrom = require('deep-require-from')
const pkg = deepRequireFrom(__dirname, ['mos', 'chalk', './package.json'])
console.log(pkg.name)
//> chalkLike require(), throws when the module can't be found.
Returns null instead of throwing when the module can't be found.
Type: string[]
An array of module IDs, a module ID is something that you pass to require().
- deep-resolve-from - Resolve the path of a module through a sequence of packages
- deep-resolve-cwd - Resolve the path of a module through a sequence of packages from the current working directory
-
req-from - Require a module like
require()but from a given path