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

Fix systemjs-angular-loader.js for external templates (#444) #445

Merged
merged 1 commit into from
Apr 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/systemjs-angular-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;

module.exports.translate = function(load){
if (load.source.indexOf('moduleId') != -1) return load;

var url = document.createElement('a');
url.href = load.address;

Expand All @@ -15,7 +17,9 @@ module.exports.translate = function(load){
baseHref.href = this.baseURL;
baseHref = baseHref.pathname;

basePath = basePath.replace(baseHref, '');
if (!baseHref.startsWith('/base/')) { // it is not karma
basePath = basePath.replace(baseHref, '');
}

load.source = load.source
.replace(templateUrlRegex, function(match, quote, url){
Expand Down