Skip to content

Commit

Permalink
ENGCOM-7914: RequireJS resolver sometimes fails to detect blocked res…
Browse files Browse the repository at this point in the history
…ources #28117
  • Loading branch information
gabrieldagama authored Sep 21, 2020
2 parents 3553b8a + a5d138b commit d7f3e8c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/web/mage/requirejs/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ define([
return registry[module.id] && (registry[module.id].inited || registry[module.id].error);
}

/**
* Checks if provided module had path fallback triggered.
*
* @param {Object} module - Module to be checked.
* @return {Boolean}
*/
function isPathFallback(module) {
return registry[module.id] && registry[module.id].events.error;
}

/**
* Checks if provided module has unresolved dependencies.
*
Expand All @@ -48,7 +58,8 @@ define([
return false;
}

return module.depCount > _.filter(module.depMaps, isRejected).length;
return module.depCount >
_.filter(module.depMaps, isRejected).length + _.filter(module.depMaps, isPathFallback).length;
}

/**
Expand Down

0 comments on commit d7f3e8c

Please sign in to comment.