From 45e222ad6fe767fe5841ae3c52fa542cf0fc455e Mon Sep 17 00:00:00 2001 From: Philip Ullrich Date: Tue, 5 May 2020 11:50:08 +0200 Subject: [PATCH 1/2] fix(polyfill): add proper url base to import shim URL needs absolute address in second part of constructor --- src/compiler/output-targets/dist-lazy/generate-system.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/output-targets/dist-lazy/generate-system.ts b/src/compiler/output-targets/dist-lazy/generate-system.ts index 888d048171d..fd1091bcea5 100644 --- a/src/compiler/output-targets/dist-lazy/generate-system.ts +++ b/src/compiler/output-targets/dist-lazy/generate-system.ts @@ -61,7 +61,7 @@ const getSystemLoader = async (config: d.Config, compilerCtx: d.CompilerCtx, cor var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : ''; var start = function() { - var url = new URL('${corePath}', resourcesUrl); + var url = new URL('${corePath}', window.location.href + resourcesUrl); System.import(url.href); }; From 0497cb4067d6e05178ea5d2b2fb7c7409a532c1f Mon Sep 17 00:00:00 2001 From: Philip Ullrich Date: Thu, 7 May 2020 11:18:54 +0200 Subject: [PATCH 2/2] fix(polyfills): better import shim url construction see PR discussion for details --- src/compiler/output-targets/dist-lazy/generate-system.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/output-targets/dist-lazy/generate-system.ts b/src/compiler/output-targets/dist-lazy/generate-system.ts index fd1091bcea5..cc45546977a 100644 --- a/src/compiler/output-targets/dist-lazy/generate-system.ts +++ b/src/compiler/output-targets/dist-lazy/generate-system.ts @@ -61,7 +61,7 @@ const getSystemLoader = async (config: d.Config, compilerCtx: d.CompilerCtx, cor var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : ''; var start = function() { - var url = new URL('${corePath}', window.location.href + resourcesUrl); + var url = new URL('${corePath}', new URL(resourcesUrl, window.location.origin)); System.import(url.href); };