-1

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.

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225

1 Answers1

0

I ended up using a custom require function, found in another answer.

function requireUncached(module){
    delete require.cache[require.resolve(module)]
    return require(module)
}
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225