Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
support conditional aliases, alias subpath fix
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Mar 10, 2016
1 parent 7345bf6 commit a015a0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ function getAlias(loader, canonicalName) {
if (pluginIndex != -1)
return getAlias(loader, canonicalName.substr(0, pluginIndex)) + '!' + getAlias(loader, canonicalName.substr(pluginIndex + 1));

// replace subpath conditionals with subpath
canonicalName = canonicalName.replace('/#:./', '/');

if (canonicalName.match(/\#[\:\{\?]/))
throw new Error('Unable to alias the conditional dependency "' + canonicalName + '".');

Expand All @@ -91,7 +94,7 @@ function getAlias(loader, canonicalName) {
else if (canonicalName.substr(0, mapped.length) == mapped &&
(canonicalName.length == mapped.length || canonicalName[mapped.length] == '/')) {
bestAlias = alias;
bestAliasSubpath = canonicalName.substr(alias.length);
bestAliasSubpath = canonicalName.substr(mapped.length);
bestAliasLength = alias.split('/').length;
}
});
Expand Down

0 comments on commit a015a0d

Please sign in to comment.