devtool icon indicating copy to clipboard operation
devtool copied to clipboard

Relative `require` paths do not work in the Console

Open aleclarson opened this issue 9 years ago • 0 comments

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')

aleclarson avatar Jul 29 '16 05:07 aleclarson