0

Let's assume the module I am requiring has no dependencies. For example, a json file, or a webpack compiled file.

Is there a built in method (or an npm package) that allows you to resolve live instances of files in node?

For example:

foo.js

module.exports = function() {
  return 'test!';
}

implementation.js

var liveFoo = require("live-monitor")("foo");
console.log(liveFoo.instance()); // this will auto update when saving foo.js.

I'd imagine this hypothetical node module live-monitor would internally use fs.watch to update the instance export as the file foo.js is changed.

So, anything built in to node? Any package out there that does this already?

Paul Knopf
  • 9,568
  • 23
  • 77
  • 142

0 Answers0