Skip to content

Commit

Permalink
fix: fix import specifier for Router in generated entrypoint (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhr authored Jun 24, 2023
1 parent 3a862d7 commit 8d3ee82
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))`
Expand Down

0 comments on commit 8d3ee82

Please sign in to comment.