diff --git a/cli.ts b/cli.ts old mode 100644 new mode 100755 diff --git a/server.ts b/server.ts old mode 100755 new mode 100644 index 9ccb9b4..901cf15 --- a/server.ts +++ b/server.ts @@ -6,6 +6,13 @@ export async function processRequest( runner = Deno.run, fetcher = fetch, ): Promise { + if (req.method == "OPTIONS") { + return new Response(undefined, { + headers: { + "Access-Control-Allow-Origin": "*", + }, + }); + } if (req.method != "GET") { return new Response(undefined, { status: 405 }); } @@ -44,7 +51,12 @@ async function bundle( const output = await process.output(); const status = await process.status(); if (status.success) { - return new Response(output); + return new Response(output, { + headers: { + "Content-Type": "text/javascript", + "Access-Control-Allow-Origin": "*", + }, + }); } else { return new Response( `console.error("bundler error - Failed to bundle ${path}");`, @@ -65,7 +77,7 @@ export async function serveBundles(hostpath: string, port: number) { const response = await processRequest(req.request, hostpath); await req.respondWith(response); } catch (err) { - // console.error(err); + console.error(err); await req.respondWith(Response.error()); } }