Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 456b849

Browse files
committed
fix(systemjs-angular-loader): replace w/ version that works in IE
1 parent e7fd753 commit 456b849

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ Upgraders: for a fresh start, consider running these commands
33
* `git clean -xdf`
44
* `npm install`
55

6+
<a name="0.4.1"></a>
7+
# 0.4.1 (2017-03-24)
8+
* Replace systemjs-angular-loader with version that works for IE
9+
610
<a name="0.4.0"></a>
711
# 0.4.0 (2017-03-24)
812
* Update to Angular 4.0.0

src/systemjs-angular-loader.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
33
var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
44

55
module.exports.translate = function(load){
6-
7-
var url = new URL(load.address);
6+
var url = document.createElement('a');
7+
url.href = load.address;
88

99
var basePathParts = url.pathname.split('/');
1010

1111
basePathParts.pop();
1212
var basePath = basePathParts.join('/');
1313

14-
var baseHref = new URL(this.baseURL).pathname;
14+
var baseHref = document.createElement('a');
15+
baseHref.href = this.baseURL;
16+
baseHref = baseHref.pathname;
1517

1618
basePath = basePath.replace(baseHref, '');
1719

@@ -23,16 +25,16 @@ module.exports.translate = function(load){
2325
resolvedUrl = basePath + url.substr(1);
2426
}
2527

26-
return `templateUrl: '${resolvedUrl}'`;
28+
return 'templateUrl: "' + resolvedUrl + '"';
2729
})
2830
.replace(stylesRegex, function(match, relativeUrls) {
2931
var urls = [];
3032

3133
while ((match = stringRegex.exec(relativeUrls)) !== null) {
3234
if (match[2].startsWith('.')) {
33-
urls.push(`'${basePath}${match[2].substr(1)}'`);
35+
urls.push('"' + basePath + match[2].substr(1) + '"');
3436
} else {
35-
urls.push(`'${match[2]}'`);
37+
urls.push('"' + match[2] + '"');
3638
}
3739
}
3840

0 commit comments

Comments
 (0)