Standard dynamic imports with a few extra features
npm install load-module





Standard dynamic imports intended for runtime loading of user-defined modules (e.g. plugins).
- Search for modules in one or more specific folders.
- Specify a base folder from which to resolve from (e.g. the current working directory).
``js
import { loadModule } from 'load-module'
const ViewClass = await loadModule('default-view', { paths: '~/my-view-folder'})
const view = new ViewClass()
`
* load-module
* loadModule(specifier, options)
* loadModuleSpecifier(specifier)
* loadModuleResolvedFrom(specifier, paths)
* loadModuleRelativeTo(specifier, paths)
Kind: exported function
| Param | Type | Description |
| --- | --- | --- |
| specifier | string | A valid Node.js module specifier. |string[]
| options.paths | | One or more directories to pass to both loadModuleResolvedFrom and loadModuleRelativeTo. |string[]
| options.resolvedFromPaths | | Specific directories to pass to loadModuleResolvedFrom. |string[]
| options.relativeToPaths | | Specific directories to pass to loadModuleRelativeTo. |
Kind: exported function
| Param | Type | Description |
| --- | --- | --- |
| specifier | string | A valid Node.js module specifier. |
Kind: exported function
| Param | Type | Description |
| --- | --- | --- |
| specifier | string | A valid Node.js module specifier. |string
| paths | \| Array. | One or more additional directories from which to resolve the supplied specifier from. |
Kind: exported function
| Param | Type | Description |
| --- | --- | --- |
| specifier | string | A valid module path. |string
| paths | \| Array.
*
© 2017-24 Lloyd Brookes \<75pound@gmail.com\>.
Tested by test-runner. Documented by jsdoc-to-markdown.