drex - "dynamic require() extension".
Dynamic version of Node's require() - loads fresh copy of the module every time the module file is changed.
Insanely simple, and/but astonishingly useful grab of bits, which has been brought to this world out of severe necessity.
Here is why:
drex, and it comes like this:
var drex = ;... node code node code node code ...// here goes my frea[ky/quently updated] piece of code, which lives in a js file called mucode.js:drex;
frequently updated/added socket.io event handlers:
drex.require(<module reference>, <callBack>);
<module reference> resolvable Node module reference, such as './module.js'
<callBack> function which is being called when the module has been
module: reference to the require()d module, and
filepath: full path to the module's file
npm install drex
#Even more simple installation#
drex.js to the place where Node can find it, i.e. for
require('./drex.js') - to the root of your Node project.
drex is watching a module for updates and cleanly re-requires the module after the update.
New code is being
require()d as if the new code is a totally different module, so
require.cache is not a problem.