Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

load-module

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-module

Standard dynamic imports with a few extra features

  • 4.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98K
decreased by-17.14%
Maintainers
1
Weekly downloads
 
Created
Source

view on npm npm module downloads Gihub repo dependents Gihub package dependents Node.js CI Coverage Status js-standard-style

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).

Synopsis

import { loadModule } from 'load-module'

const ViewClass = await loadModule('default-view', { paths: '~/my-view-folder'})
const view = new ViewClass()

load-module

loadModule(specifier, options)

Kind: exported function

ParamTypeDescription
specifierstringA valid Node.js module specifier.
options.pathsstring[]One or more directories to pass to both loadModuleResolvedFrom and loadModuleRelativeTo.
options.resolvedFromPathsstring[]Specific directories to pass to loadModuleResolvedFrom.
options.relativeToPathsstring[]Specific directories to pass to loadModuleRelativeTo.

loadModuleSpecifier(specifier)

Kind: exported function

ParamTypeDescription
specifierstringA valid Node.js module specifier.

loadModuleResolvedFrom(specifier, paths)

Kind: exported function

ParamTypeDescription
specifierstringA valid Node.js module specifier.
pathsstring | Array.<string>One or more additional directories from which to resolve the supplied specifier from.

loadModuleRelativeTo(specifier, paths)

Kind: exported function

ParamTypeDescription
specifierstringA valid module path.
pathsstring | 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.

Keywords

FAQs

Package last updated on 13 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc