function compile(filePath, code, checkCache = true) {
    if (checkCache) {
      const cachedCode = cache.get(filePath);
      if (cachedCode) {
        return cachedCode;
      }
    }

    // if we should not babel compile some files, only add them to the cache
    if (config.exclude) {
      if (config.exclude.some(exclude => minimatch(filePath, exclude))) {
        addToCache(filePath, code);
        return code;
      }
    }

    const compiled = babelCompile(filePath, code);
    addToCache(filePath, compiled);
    return compiled;
  }
Compiles given code at the given filepath. If getFromCache is true, returns the cached
compiled code.

@param {string} filePath
@param {string} code
@param {boolean} checkCache
@returns {string}