Skip to content

Commit de58fc2

Browse files
authored
Update live-view.js
1 parent 76ca48a commit de58fc2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

live-view.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ async function fetchLiveViewScripts(frameDocument) {
678678
const linkHref = new URL(script.src);
679679
const fileName = linkHref.pathname.slice(1);
680680

681-
if (/*linkHref.origin == window.location.origin*/ true) {
681+
if (linkHref.origin == window.location.origin) {
682682

683683
const file = Object.values(modifiedFiles).filter(file => (file.dir == selectedFile.dir.split(',') && file.name == fileName));
684684
let resp;
@@ -693,15 +693,17 @@ async function fetchLiveViewScripts(frameDocument) {
693693

694694
}
695695

696-
addScript(frameDocument, decodeUnicode(resp.content));
696+
addScript(frameDocument, decodeUnicode(resp.content), '', script.type);
697697

698698
// remove original tag
699699
script.remove();
700700

701701
} else {
702702

703-
addScript(frameDocument, '', script.src, script.type);
704-
703+
let resp = await axios.get(script.src);
704+
705+
addScript(frameDocument, resp, '', script.type);
706+
705707
// delete original
706708
script.remove();
707709

@@ -734,7 +736,7 @@ function addScript(documentNode, code, src, type) {
734736
} else {
735737

736738
script.src = src;
737-
script.defer = false;
739+
script.defer = true;
738740
script.async = false;
739741

740742
}

0 commit comments

Comments
 (0)