honojs / vite-plugins

Vite Plugins for Hono
https://hono.dev
134 stars 35 forks source link

CF properties with vite dev #160

Closed vickyRathee closed 3 months ago

vickyRathee commented 3 months ago

What version of Hono are you using?

4.5.5

What runtime/platform is your app running on?

Cloudflare pages

What steps can reproduce the bug?

The cf properties are missing in Cloudflare vite adapter which is causing exception in the application migration from older version of Hono + Cloudflare pages where I was using function/[[server]].ts to build the application directly with wrangler instead vite

app.get("/", (c) => {
  const { cf } = c.req.raw;
  return c.render(`Hello from: ${cf.country}`);
});

image

What is the expected behavior?

vite adapter should have cf properties

What do you see instead?

An exception

Additional information

No response

yusukebe commented 3 months ago

Hi @vickyRathee

This is a @hono/vite-dev-server issue. I will resolve it.

yusukebe commented 3 months ago

Hey @vickyRathee

This is fixed in the new version of @hono/vite-dev-server. So please upgrade it: npm i @hono/vite-dev-server.

vickyRathee commented 3 months ago

@yusukebe thanks for quick resolution.