I have a JSON object that I'm loading every 2 seconds.
If I use:
colorObj = require('file.json');
It causes file.json
to be cached and the values will never update.
I have a JSON object that I'm loading every 2 seconds.
If I use:
colorObj = require('file.json');
It causes file.json
to be cached and the values will never update.
I ended up using a custom require function, found in another answer.
function requireUncached(module){
delete require.cache[require.resolve(module)]
return require(module)
}