jan-swiecki / node-hotload

Hot load (hot require) for NodeJS. It's like JRebel but for NodeJS.
MIT License
19 stars 12 forks source link

use process.cwd() as the main directory in REPL. #4

Open muddletoes opened 9 years ago

muddletoes commented 9 years ago

Specifically, if require.main is not defined, the variable mainDir will be set to process.cwd().

This will prevent a fatal error, and instead allow a basic level of REPL support.

There are some limitations that might not be obvious: changes to the process working directory will not be tracked, and the node-hotload module will sometimes fail silently if one saves a unsyntactic version of the code being watched; the node-hotload module then requires reloading from cache.