Skip to content

Instantly share code, notes, and snippets.

@ricokahler
Created September 4, 2020 00:48
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 ricokahler/200685b7da2920442bc1a795fcf7137f to your computer and use it in GitHub Desktop.
Save ricokahler/200685b7da2920442bc1a795fcf7137f to your computer and use it in GitHub Desktop.
register function
const path = require('path');
require('@babel/register')({ extensions: ['.js', '.ts', '.tsx'] });
const args = process.argv.slice(2);
if (args[0] === '--') {
const filename = args[1];
// require relative to the root
require(path.resolve(__dirname, '../', filename));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment