Skip to content

Commit 3a9e643

Browse files
committed
fix(loader): load from external domain
1 parent d1d88e5 commit 3a9e643

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/client/import-shims.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const patchBrowser = async () => {
1515
// @ts-ignore
1616
const importMeta = import.meta.url;
1717
if (importMeta !== '') {
18-
return Promise.resolve(new URL('.', importMeta).pathname);
18+
return Promise.resolve(new URL('.', importMeta).href);
1919
} else {
2020
const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => (
2121
s.src.includes(`/${NAMESPACE}.esm.js`) ||
@@ -29,7 +29,7 @@ export const patchBrowser = async () => {
2929
// @ts-ignore
3030
await import('./polyfills/dom.js');
3131
}
32-
return resourcesUrl.pathname;
32+
return resourcesUrl.href;
3333
}
3434
};
3535

src/client/polyfills/system.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compiler/component-lazy/generate-system.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ for (var x = allScripts.length - 1; x >= 0; x--) {
5858
}
5959
var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
6060
var start = function() {
61-
System.import(new URL('${corePath}', resourcesUrl).pathname);
61+
var url = new URL('${corePath}', resourcesUrl);
62+
System.import('//' + url.host + url.pathname);
6263
};
6364
6465
if (win.__stencil_cssshim) {

src/runtime/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const getConnect = (_ref: d.HostRef, tagName: string) => {
99
elm = doc.createElement(tagName) as any;
1010
doc.body.appendChild(elm);
1111
}
12-
return 'componentOnReady' in elm ? elm.componentOnReady() : Promise.resolve(elm);
12+
return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
1313
}
1414

1515
function create(...args: any[]) {

0 commit comments

Comments
 (0)