JSPM

deep-require-from

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1903
  • Score
    100M100P100Q107850F
  • License MIT

Require a module like `require()` but via a sequence of nested packages

Package Exports

  • deep-require-from

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deep-require-from) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

deep-require-from

Require a module like `require()` but via a sequence of nested packages

npm version Build Status

Installation

npm i -S deep-require-from

Usage

'use strict'
const deepRequireFrom = require('deep-require-from')

const pkg = deepRequireFrom(__dirname, ['mos', 'chalk', './package.json'])

console.log(pkg.name)
//> chalk

API

deepRequireFrom(fromDir, moduleIds)

Like require(), throws when the module can't be found.

deepRequireFrom.silent(fromDir, moduleIds)

Returns null instead of throwing when the module can't be found.

moduleIds

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

License

MIT © Zoltan Kochan