diff --git a/Source/Function/Worker.ts b/Source/Function/Worker.ts index efb86233..1d9bb7bb 100644 --- a/Source/Function/Worker.ts +++ b/Source/Function/Worker.ts @@ -7,10 +7,11 @@ export default >{ const url = new URL(request.url); if (url.pathname.startsWith("/functions/")) { - // const File = await import(url.pathname); - // console.log(process.cwd()); + const File = await import(url.pathname); - // console.log((await import("fs")).readFile(url.pathname)); + console.log(process.cwd()); + + console.log(await (await import("fs/promises")).readFile(File)); return new Response(url.pathname, { headers: { "Content-Type": "text/html" }, diff --git a/Target/Function/Worker.js b/Target/Function/Worker.js index bbef1452..aa1d1af6 100644 --- a/Target/Function/Worker.js +++ b/Target/Function/Worker.js @@ -1 +1 @@ -var r={fetch:async(e,t)=>{const n=new URL(e.url);return n.pathname.startsWith("/functions/")?new Response(n.pathname,{headers:{"Content-Type":"text/html"}}):t.ASSETS.fetch(e)}};export{r as default}; +var o={fetch:async(t,n)=>{const e=new URL(t.url);if(e.pathname.startsWith("/functions/")){const a=await import(e.pathname);return console.log(process.cwd()),console.log((await import("fs")).readFile(e.pathname)),new Response(e.pathname,{headers:{"Content-Type":"text/html"}})}return n.ASSETS.fetch(t)}};export{o as default};