location relative path fix

This commit is contained in:
guybedford 2013-10-29 19:54:27 +02:00
parent 0eb2bda992
commit 87f5908eb6
4 changed files with 13 additions and 4 deletions

View File

@ -350,9 +350,16 @@
// module names starting with '#' are never normalized
// useful for plugins where the import doesn't represent a real path
if (name.substr(0, 1) != '#') {
// location relative normalization
if (name.substr(0, 2) == './' && referer && referer.name && referer.name.indexOf(':') != -1)
name = referer.name.substr(0, referer.name.indexOf(':') + 1) + name.substr(2);
// do standard normalization (resolve relative module name)
name = global.System.normalize(name, referer);
else
name = global.System.normalize(name, referer);
console.log(name);
// do map config
name = applyMap(name, parentName);
@ -361,7 +368,6 @@
if (pluginName)
name = name + '!' + pluginName;
return name;
},
resolve: function(name, options) {
@ -821,7 +827,7 @@
github: 'https://github.jspm.io',
npm: 'https://npm.jspm.io',
cdnjs: 'https://cdnjs.cloudflare.com/ajax/libs',
plugin: 'https://github.jspm.io/jspm/plugins@0.0.8'
plugin: 'https://github.jspm.io/jspm/plugins@master'
}
});

View File

@ -123,6 +123,7 @@
jspm.import(['mypath:path'], complete);
},
confirm: function(m) {
console.log(m);
if (m != 'path')
return 'module not loaded';
}

1
test/tests/dep.js Normal file
View File

@ -0,0 +1 @@
define({});

View File

@ -1 +1,2 @@
window.p = 'path';
require('./dep');
module.exports = 'path';