diff --git a/insights/core/dr.py b/insights/core/dr.py
index <HASH>..<HASH> 100644
--- a/insights/core/dr.py
+++ b/insights/core/dr.py
@@ -394,11 +394,16 @@ def _import(path, continue_on_error):
 
 
 def _load_components(path, include=".*", exclude="test", continue_on_error=True):
+    do_include = re.compile(include).search if include else lambda x: True
+    do_exclude = re.compile(exclude).search if exclude else lambda x: False
+
     num_loaded = 0
     if path.endswith(".py"):
         path, _ = os.path.splitext(path)
 
     path = path.rstrip("/").replace("/", ".")
+    if do_exclude(path):
+        return 0
 
     package = _import(path, continue_on_error)
     if not package:
@@ -406,9 +411,6 @@ def _load_components(path, include=".*", exclude="test", continue_on_error=True)
 
     num_loaded += 1
 
-    do_include = re.compile(include).search if include else lambda x: True
-    do_exclude = re.compile(exclude).search if exclude else lambda x: False
-
     if not hasattr(package, "__path__"):
         return num_loaded
Fix excludes not working in _load_components (#<I>)

* Moved the do_include and do_exclude to the top and added a check for

  excludes before importing path.