Experience-Monks / devtool

[OBSOLETE] runs Node.js programs through Chromium DevTools
MIT License
3.76k stars 148 forks source link

Relative `require` paths do not work in the Console #84

Open aleclarson opened 8 years ago

aleclarson commented 8 years ago

Assuming I'm in the parent directory of the module I'm attempting to require...

devtool

Then type in the Console:

require('./my-module') // throws error: Cannot find module './my-module'

Since no __dirname exists in the Console, the relative require cannot be resolved by Electron.


The workaround:

require(process.cwd() + '/my-module')