2.0.0 • Published 2 years ago

require-runtime v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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