gale/src/boot.js

15 lines
502 B
JavaScript

(
(root="/")=>fetch(root+"deno.json")
.then(text=>text.json())
.then(json=>{
const n=(t,e)=>{let n=document.createElement("script");n.type=t,n.textContent=e,document.head.appendChild(n)};
const imports = json.imports;
for(let n in imports)
{
const path=imports[n];
path.startsWith("./")&&(imports[n]=root+path.substring(2))
}
n("importmap",JSON.stringify({imports})),
n("module",'import "entry"; ')
})
)();