peach a19a732be8 commit message 2 years ago
..
CHANGELOG.md a19a732be8 commit message 2 years ago
LICENSE a19a732be8 commit message 2 years ago
README.md a19a732be8 commit message 2 years ago
create-require.d.ts a19a732be8 commit message 2 years ago
create-require.js a19a732be8 commit message 2 years ago
package.json a19a732be8 commit message 2 years ago

README.md

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