Require a module like `require()` but via a sequence of nested packages from the current working directory
npm i -S deep-require-cwd
'use strict'
const deepRequireCwd = require('deep-require-cwd')
const pkg = deepRequireCwd(['mos', 'chalk', './package.json'])
console.log(pkg.name)
//> chalk
Like 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-require-from - Require a module like
require()
but via a sequence of nested packages - 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-cwd - Require a module like
require()
but from the current working directory