create-require
Polyfill for Node.js module.createRequire
(<= v12.2.0)
yarn add create-require
npm install create-require
function createRequire (filename: string | URL): NodeRequire;
const createRequire = require('create-require')
const myRequire = createRequire('path/to/test.js')
const myModule = myRequire('./test-sibling-module')