JSPM

require-runtime

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q18172F
  • License MIT

Use require() at runtime (useful when using pkg)

Package Exports

  • require-runtime
  • require-runtime/require-runtime.js

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

Readme

require-runtime

Use require() at runtime (useful when using pkg)

Usage

const requireRuntime = require('require-runtime')

// Now you can use requireRuntime() instead of
// require() to simply require modules at runtime

requireRuntime('my-module.js')

Example

example/index.js

const requireRuntime = require('require-runtime')

const myFunc = requireRuntime('example-module.js')

myFunc('a', 'b', 'c')

example/example-module.js

console.log('Hi!')

const myFunc = (a, b, c) => {
    console.log(a, b, c)
}

module.exports = myFunc