From 8d3ee823ffc470fc91aae14d6d0ab2c33fb6781e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=CA=9C=C9=AA=E1=B4=8D=E1=B4=9C=CA=80=E1=B4=80=20Yu=CC=84?= Date: Sun, 25 Jun 2023 01:51:56 +0900 Subject: [PATCH] fix: fix import specifier for `Router` in generated entrypoint (#4) --- src/Router.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Router.ts b/src/Router.ts index 79550ea..84a53dc 100644 --- a/src/Router.ts +++ b/src/Router.ts @@ -119,8 +119,10 @@ const emit = async (root: URL, routes: Routes) => { }) .join("\n") const self = new URL(import.meta.url) - const specifierRouter = isFileUrl(self) ? relative(root.pathname, self.pathname) : self - content += `\nimport Router from "./${specifierRouter}"` + const specifierRouter = isFileUrl(self) + ? `./${relative(root.pathname, self.pathname)}` + : self.href + content += `\nimport Router from "${specifierRouter}"` content += `\nimport { serve } from "https://deno.land/std@0.192.0/http/server.ts"` content += `\nconst routetslist = ${Deno.inspect([...map.entries()])} as const` content += `\nawait serve(await new Router(routetslist))`