JSPM

require-module

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1488
  • Score
    100M100P100Q103639F
  • License

Requires a module found relative to given root or working directory.

Package Exports

  • require-module

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 (require-module) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

require-module build status

Requires a module found relative to given root or working directory.

var requireModule = require('require-module');

// require relative-module which is located relative to current directory
var relative = requireModule('./relative-module.js');

// require tap module installed in ../dir/node_modules
var tap = requireModule('tap', path.join(__dirname, '..', 'dir'));

Installation

npm install require-module

API

requireModule(module, root)

Parameters

module: String, name of an installed module or path to a module to be required.

root: String=, defaults to current working directory

Returns

Object, the result of requiring the module

Kudos

Adapted function found in @substack's catw module

License

MIT