honojs / honox

HonoX - Hono based meta framework
https://hono.dev
MIT License
1.16k stars 34 forks source link

disableSSG from hono/ssg is not work with HonoX #58

Closed berlysia closed 3 months ago

berlysia commented 5 months ago

What version of HonoX are you using?

0.1.1

What steps can reproduce the bug?

  1. npx create hono@latest , select "x-basic"
  2. Add routes using Hono instance or createRoute and use disableSSG from "hono/ssg"
  3. Generate pages by build.ts that runs https://github.com/honojs/vite-plugins/blob/55e3abfb8017c7ee9606458da665e3f09e0d428f/packages/ssg/src/ssg.ts#L34-L50 , or use "@hono/vite-ssg"
  4. Generated codes include text files that contains "SSG is disabled"

What is the expected behavior?

Not even a text file containing "SSG is disabled" is left behind, and nothing is generated from the disableSSG route.

What do you see instead?

Text files that contains "SSG is disabled"

Additional information

This is runtime agnostic issue. Reproduced in Node v21.6.0, Bun 1.0.23, Deno 1.39.4

berlysia commented 5 months ago

Maybe I should write this in https://github.com/honojs/hono ?

usualoma commented 5 months ago

Hi @berlysia. Thank you!

I believe this is a regression due to the following change. This mechanism did not work when notFound was wrapped in jsxRenderer as in honox https://github.com/honojs/hono/pull/2179

However, I also believe that this problem is not due to the PR above, but rather to the "output of a page that returns a 404". I think the following issues also need to be discussed at the same time https://github.com/honojs/hono/issues/2180

P.S. If you have stream enabled, maybe the following issues are also relevant. https://github.com/honojs/hono/pull/2218

berlysia commented 5 months ago

In my another investigation says this issue's key line is here (by good old console debug):

https://github.com/honojs/hono/blob/553d555e096855686b64cfb56c9560606c379396/src/helper/ssg/index.ts#L154

I don't know why currently. And what's even weirder is that it works when pure hono and @hono/vite-ssg ...

berlysia commented 3 months ago

Resolved by https://github.com/honojs/hono/pull/2477 , thanks!