require-runtime

2.0.0 • Public • Published

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

Package Sidebar

Install

npm i require-runtime

Weekly Downloads

38

Version

2.0.0

License

MIT

Unpacked Size

2.98 kB

Total Files

7

Last publish

Collaborators

  • greencoder001