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

Commit

Permalink
chore: fix systemjs-angular-loader.js for external templates (#444) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
feelingsofwhite authored and Foxandxss committed Apr 27, 2017
1 parent 418dc2e commit 87ad8f5
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit 87ad8f5

Please sign in to comment.