testtest/node_modules/create-require
AlexVeeBee 30ce160b8f
Some checks failed
node-js / Test (14.x) (push) Failing after 18s
Did something
2024-02-27 00:32:49 +00:00
..
CHANGELOG.md Did something 2024-02-27 00:32:49 +00:00
create-require.d.ts Did something 2024-02-27 00:32:49 +00:00
create-require.js Did something 2024-02-27 00:32:49 +00:00
LICENSE Did something 2024-02-27 00:32:49 +00:00
package.json Did something 2024-02-27 00:32:49 +00:00
README.md Did something 2024-02-27 00:32:49 +00:00

create-require

npm version npm downloads Github Actions Codecov

Polyfill for Node.js module.createRequire (<= v12.2.0)

Install

yarn add create-require

npm install create-require

Usage

function createRequire (filename: string | URL): NodeRequire;
const createRequire = require('create-require')

const myRequire = createRequire('path/to/test.js')
const myModule = myRequire('./test-sibling-module')

License

MIT