diff --git a/project_composer.module b/project_composer.module
index 68bea85f1c9db68e742d3688f120876f724945ae..14dd5f3c0de115df6d5f668a37cfff3aa935a18a 100644
--- a/project_composer.module
+++ b/project_composer.module
@@ -1683,16 +1683,18 @@ function _project_composer_delete_providers($release_category, $project_nid, $pr
  * @param $project_name
  * @param $component_name
  * @param null $project_nid
+ *   Omit for resolving a dependency.
  *
  * @return mixed
  */
 function _project_composer_get_packagename($release_category, $project_name, $component_name = NULL, $project_nid = NULL) {
-  // package name for drupal dependencies is always drupal, or core. And we do not want to save anything for
-  // core dependencies to the namespace map.
+  // Package name for Drupal dependencies is always 'drupal', or core. And we
+  // do not want to save anything for core dependencies to the namespace map.
 
-  // Some core modules have been removed, so dependencies on 'drupal:removed_module' should now resolve to the project instead of drupal/core
-  $removed_core_modules = _project_composer_get_removed_components($release_category);
-  if (in_array($component_name,$removed_core_modules)) {
+  // Some core modules have been removed, so dependencies on
+  // 'drupal:removed_module' should now resolve to the project instead of
+  // 'drupal/core'
+  if (is_null($project_nid) && in_array($component_name, _project_composer_get_removed_components($release_category))) {
     $project_name = $component_name;
   }