load-module
Node's `require` with a few extra features
Last updated 6 years ago by 75lb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install load-module 
SYNC missed versions from official npm registry.

view on npm npm module downloads Gihub repo dependents Gihub package dependents Build Status Coverage Status js-standard-style

load-module

Standard dynamic imports but with a few additional features:

  • You can supply specific folders in which to search for modules (e.g. any local directory).
  • You can specify a base folder from which to resolve from (e.g. the current working directory).

Synopsis

> const loadModule = require('load-module')
> loadModule('react-dom')
> loadModule('something.mjs', { paths: process.cwd() })
> loadModule('something.mjs', { paths: [process.cwd(), '~/my-modules'] })

load-module

loadModule.loadModuleSpecifier(specifier)

Kind: static method of load-module

Param Type Description
specifier string A valid Node.js module specifier.

loadModule.loadModuleResolvedFrom(specifier, paths)

Kind: static method of load-module

Param Type Description
specifier string A valid Node.js module specifier.
paths string | Array.<string> One or more additional directories from which to resolve the supplied specifier from.

loadModule.loadModulePathRelativeTo(specifier, paths)

Kind: static method of load-module

Param Type Description
specifier string A valid module path.
paths string | Array.<string> One or more additional directories in which to search for the supplied module path.

© 2017-21 Lloyd Brookes <75pound@gmail.com>.

Tested by test-runner. Documented by jsdoc-to-markdown.

Current Tags

  • 5.0.0                                ...           latest (2 years ago)
  • 4.0.0-2                                ...           next (6 years ago)

25 Versions

  • 5.0.0                                ...           2 years ago
  • 4.2.1                                ...           5 years ago
  • 4.2.0                                ...           5 years ago
  • 4.1.0                                ...           5 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 4.0.0-2                                ...           6 years ago
  • 4.0.0-1                                ...           6 years ago
  • 4.0.0-0                                ...           6 years ago
  • 3.0.1-0                                ...           6 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.2.5                                ...           8 years ago
  • 0.2.4                                ...           9 years ago
  • 0.2.3                                ...           9 years ago
  • 0.2.2                                ...           9 years ago
  • 0.2.1                                ...           9 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.3                                ...           9 years ago
  • 0.1.2                                ...           9 years ago
  • 0.1.1                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 98
Today 0
This Week 4
This Month 38
Last Day 0
Last Week 12
Last Month 26
Dependencies (1)
Dev Dependencies (5)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE