Closed jxmot closed 3 years ago
This is the work-around (tested OK) -
// NOTE: require() does caching of modules, info:
// https://bambielli.com/til/2017-04-30-node-require-cache/
//
// Also using every() instead of forEach() to allow the ability
// to break the loop:
// https://masteringjs.io/tutorials/fundamentals/foreach-break
Object.keys(require.cache).every( (key) => {
if(key.includes('reportdefs.js')) {
// remove the module from the cache
delete require.cache[key];
// done!
return false;
}
return true;
});
const reportdefs = require('./reportdefs.js');
resolved in the 20210531-logreporter branch
The fact that
require()
will cache modules, and will not reload them even with explicitrequire()
calls.A work-around or means to disable the caching is needed.