Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Created April 25, 2019 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MylesBorins/a7c6d25c6d08d6bed9c45c83fbe26bb3 to your computer and use it in GitHub Desktop.
Save MylesBorins/a7c6d25c6d08d6bed9c45c83fbe26bb3 to your computer and use it in GitHub Desktop.
Module.createRequire = (file) => {
let path;
try {
path = fileURLToPath(file);
}
catch (e) {
if (e.code === 'ERR_INVALID_URL_SCHEME') {
throw e;
}
path = file;
}
return Module.createRequireFromPath(path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment