From f26e9edeb8a84b2418a5ecbd21537a9ec829e1dd Mon Sep 17 00:00:00 2001 From: feelingsofwhite Date: Wed, 26 Apr 2017 22:08:54 -0600 Subject: [PATCH] Fix systemjs-angular-loader.js for external templates (#444) --- src/systemjs-angular-loader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systemjs-angular-loader.js b/src/systemjs-angular-loader.js index 4d3e12736..8b1005444 100644 --- a/src/systemjs-angular-loader.js +++ b/src/systemjs-angular-loader.js @@ -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; @@ -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){