EntityQuery on nodes related by ERR and paragraphs
Newer versions of Drupal (tested with v8.6.2) can also resolve Paragraphs (Entity Reference Revisions) if you explicitly name the target entity type using dot notation:

$nids = \Drupal::entityQuery('node')
    -&gt;condition('status', 1)
    -&gt;condition('type', 'publication')
    -&gt;condition('field_mention.entity:paragraph.field_project.target_id', \Drupal::routeMatch()-&gt;getRawParameter('node'))
    -&gt;execute();


Note the .entity:paragraph. instead of .entity. in the referenced field condition