function requireAudit(auditPath, coreAuditList, configDir) {
  // See if the audit is a Lighthouse core audit.
  const auditPathJs = `${auditPath}.js`;
  const coreAudit = coreAuditList.find(a => a === auditPathJs);
  let requirePath = `../audits/${auditPath}`;
  if (!coreAudit) {
    if (isBundledEnvironment()) {
      // This is for plugin bundling.
      requirePath = auditPath;
    } else {
      // Otherwise, attempt to find it elsewhere. This throws if not found.
      const absolutePath = resolveModulePath(auditPath, configDir, 'audit');
      if (isBundledEnvironment()) {
        // Use a relative path so bundler can easily expose it.
        requirePath = path.relative(getModuleDirectory(import.meta), absolutePath);
      } else {
        requirePath = absolutePath;
      }
    }
  }

  return requireWrapper(requirePath);
}
@param {string} auditPath
@param {Array<string>} coreAuditList
@param {string=} configDir
@return {Promise<LH.Config.AuditDefn['implementation']>}