Closed ryuapp closed 6 months ago
Hi @ryuapp
I think the better way is to create an option like staticPaths
to apply serveStatic
:
type CloudflarePagesOptions = {
// ...
staticPaths: string[]
}
const defaultOptions: Required<CloudflarePagesOptions> = {
// ...
staticPaths: ['/favicon.ico', '/static/*']
}
What do you think?
Hello @yusukebe
Thank you for your suggestion. The options looks good. It satisfies my requirements because that can freely route depending on the settings.
However, if I actually use HonoX, I create _routes.json
with empty staticPaths
.
This is to avoid incurring charges with serveStatic
.
What I'm really looking for might be autogenerate _routes.json
.
But now staticPaths
is necessary in that it allows for free routing.
Ref: https://github.com/honojs/starter/issues/31,
I want to use a
public
directory with file-based routing on HonoX. But @hono/vite-cloudflare-pages only supportsfavicon.ico
in the root directory, other files must be placed understatic
directory. https://github.com/honojs/vite-plugins/blob/60d79860626d67622a38da138c0f12fcc33424ae/packages/cloudflare-pages/src/entry.ts#L39C1-L40C39This makes it difficult to use robots.txt and sitemap.xml. It's possible to serve them manually, but it is troublesome to set them one by one.
It's better if a
public
directory can be freely routed. In addition, it would be even better if it was realized that like #110.