text: //
  // TODO(vjpr): There are two separate caches. Require resolution and babel transpiled source. Separate them!
  //
  
  const debug = require('debug')('live')
  const roadrunner = require('roadrunner')
  const _ = require('lodash')
  
  function getOpts(opts) {
    opts.roadrunner = opts.roadrunner || {}
    _.defaults(opts.roadrunner, {
      roadrunnerCacheFile: process.cwd() + '/tmp/.roadrunner.json',
    })
    return opts
  }
  
  ////////////////////////////////////////////////////////////////////////////////
  
  let globalRoadrunnerCacheFilePath
  
  const getRequireResolveCache = module.exports.getRequireResolveCache = () => {
    roadrunner.get('babel')
  }
  
  const saveRequireResolveCache = module.exports.saveRequireResolveCache = () => {
    roadrunner.save(globalRoadrunnerCacheFilePath)
    debug('Saved roadrunner cache')
  }
  
  module.exports = function(opts = {}) {
  
    opts = getOpts(opts)
  
    globalRoadrunnerCacheFilePath = opts.roadrunnerCacheFilePath
  
    const fs = require('fs-extra')
  
    fs.ensureFileSync(opts.roadrunner.roadrunnerCacheFilePath)
  
    roadrunner.load(opts.roadrunner.roadrunnerCacheFilePath)
  
    addSaveOnExitHook()
  
  }
  
  function addSaveOnExitHook() {
  
    //roadrunner.setup() // We override this function with our own.
  
    process.on('SIGINT', function() {
  
      saveRequireResolveCache()
  
      // NOTE: `babel/register` cache hooks into `process.on('exit')`
      // and process.nextTick`.
      // The process exit hook doesnt't fire when we use CMD+C. Not sure why.
      // Maybe something to do with another module, or nodemon, or something.
      // For now, we manually trigger exit which fixes it.
  
      // TODO: This seems to cause bad exit for nodemon.
      // Maybe try process.emit('exit') ?
  
      process.exit()
  
    })
  
  }
  