Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 7d5c827

Browse files
committed
add __moduleAddress variable
1 parent 348d91b commit 7d5c827

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/loader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,8 @@ function logloads(loads) {
10671067
if (__global.btoa && sourceMap)
10681068
source += '\n//# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(sourceMap))) + '\n';
10691069

1070+
source = 'var __moduleAddress = "' + load.address + '";' + source;
1071+
10701072
__eval(source, __global, load);
10711073
}
10721074
})();

test/loader/moduleName.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export var name = __moduleName;
1+
export var name = __moduleName;
2+
export var address = __moduleAddress;

test/test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,10 @@ function runTests() {
405405
test('Module Name meta', function(assert) {
406406
System['import']('loader/moduleName').then(function(m) {
407407
assert(
408-
[m.name, 'loader/moduleName']
408+
[m.name, 'loader/moduleName'],
409+
[m.address, System.baseURL + 'loader/moduleName.js']
409410
);
410-
})
411+
});
411412
});
412413

413414
test('Custom path', function(assert) {

0 commit comments

Comments
 (0)