UNPKG

babel-node-debug

Version:
24 lines (19 loc) 613 B
console.log('!! process.argv: ', process.argv) if (process.argv[2] === '--inject-debugger') { process.argv.splice(2, 1) var fs = require('fs') var readFileSync = fs.readFileSync fs.readFileSync = function(filePath) { var contents = readFileSync.call(this, filePath, arguments[1]) console.log('filePath: ', filePath) if (filePath === mainPath) { console.log('===========> DEBUGGER') // contents = '\ndebugger;\n' + contents } return contents } } process.argv.splice(1, 1) console.log('!! process.argv: ', process.argv) var mainPath = process.argv[1] require(mainPath)