start transpile adjacent server files

This commit is contained in:
Seth Trowbridge 2023-06-08 06:37:01 -04:00
parent 6878e7e0a4
commit a9e4c0bb35

View File

@ -31,8 +31,18 @@ Configure({
}); });
return inImports; return inImports;
}, },
Serve(inReq, inURL, inExt, inMap) async Serve(inReq, inURL, inExt, inMap)
{ {
if(inURL.pathname.startsWith("/hmr/"))
{
const path = import.meta.url+"/.."+inURL.pathname;
const code = await Transpile.Fetch(path, inURL.pathname, true);
if(code)
{
return new Response(code, {headers:{"content-type":"application/javascript"}})
}
}
if(inReq.headers.get("upgrade") == "websocket") if(inReq.headers.get("upgrade") == "websocket")
{ {
try try