package global map fix

This commit is contained in:
guybedford 2015-08-24 22:58:05 +02:00
parent b5d6568b57
commit ea16d855cf
3 changed files with 8 additions and 6 deletions

View File

@ -204,17 +204,16 @@
if (mapped) {
// '.' as a target is the package itself (with package main check)
if (mapped == '.')
normalized = loader.normalizeSync(pkgName);
return loader.normalizeSync(pkgName);
// internal package map
else if (mapped.substr(0, 2) == './')
normalized = pkgName + '/' + basePath + mapped.substr(2);
return pkgName + '/' + basePath + mapped.substr(2);
// global package map
else
normalized = normalize.call(loader, mapped);
return loader.normalize.call(loader, mapped);
}
else
normalized = pkgName + '/' + basePath + normalized.substr(pkgName.length + 1) + defaultExtension;
return normalized;
return pkgName + '/' + basePath + normalized.substr(pkgName.length + 1) + defaultExtension;
});
}

View File

@ -884,6 +884,9 @@ asyncTest('Wildcard meta', function() {
asyncTest('Package configuration CommonJS config example', function() {
System.config({
map: {
'global-test': 'tests/testpkg/test.ts'
},
packagePaths: ['tests/testpk*'],
packages: {
'tests/testpkg': {

View File

@ -11,7 +11,7 @@
"./json": "./json.json",
"./dir/": "./dir/index.js",
"./dir2": "./dir2/index.json",
"./dir/test": "./test.ts",
"./dir/test": "global-test",
"./env-module": {
"browser": "./env-module-browser.js"
}