$ npm install load-module
Standard dynamic imports but with a few additional features:
> const loadModule = require('load-module')
> loadModule('react-dom')
> loadModule('something.mjs', { paths: process.cwd() })
> loadModule('something.mjs', { paths: [process.cwd(), '~/my-modules'] })
Kind: static method of load-module
| Param | Type | Description |
|---|---|---|
| specifier | string |
A valid Node.js module specifier. |
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. |
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.
© 2010 - cnpmjs.org x YWFE | Home | YWFE