ensure direct package name lookups

This commit is contained in:
guybedford 2015-08-24 14:42:08 +02:00
parent bff0c77bae
commit d5feb4fbf1
2 changed files with 7 additions and 1 deletions

View File

@ -193,7 +193,9 @@ SystemJSLoader.prototype.config = function(cfg) {
if (cfg.packages) {
for (var p in cfg.packages) {
var prop = this.normalizeSync(p);
// request with trailing "/" to get package name exactly
var prop = this.normalizeSync(p + '/');
prop = prop.substr(0, prop.length - 1);
// if doing default js extensions, undo to get package name
if (this.defaultJSExtensions && p.substr(p.length - 3, 3) != '.js')

View File

@ -181,6 +181,10 @@
if (normalized.length == pkgName.length)
return normalized + defaultExtension;
// allow for direct package name normalization with trailling "/" (no main)
if (normalized.length == pkgName.length + 1 && normalized[pkgName.length] == '/')
return normalized;
// sync normalize does not apply package map
if (sync || !pkg.map)
return pkgName + '/' + basePath + normalized.substr(pkgName.length + 1) + defaultExtension;