Skip to content

.render() does not work with @hono/vite-buildΒ #238

@muningis

Description

@muningis

(initially was created as a bug, but now it's clear it's documentation issue. Original issue content is below)

https://hono.dev/docs/getting-started/bun#change-port-number States that to change port, we should do

- export default app 
+ export default { 
+  port: 3000, 
+  fetch: app.fetch, 
+ } 

while that's fine while it's only running in bun runtime, perhaps it would be better to clarify that when, for example building with vite, it might cause conflicts?


Original issue

### What version of Hono are you using?

4.6.1

What runtime/platform is your app running on? (with version if possible)

[email protected], [email protected]

What steps can reproduce the bug?

  1. Use .render()
  2. Build with vite + @hono/vite-build
  3. Try running built server (you will get undefined is not an object (evaluating '*.routes.map'))

Reproduction repo: https://github.com/muningis/hono-issue-3917-reproduction

What is the expected behavior?

Server runs successfuly

What do you see instead?

undefined is not an object (evaluating '*.routes.map')

Additional information

Unminified JS: https://gist.github.com/muningis/0809a25b13580d5c48b854417868b841

Error happens on line 541, following declarations, you can see that routes are gone from export - however, that was written as in example here: https://hono.dev/docs/api/hono#fetch.
Seems like to be incorrect documentation. However, even if

export default {
  ...app,
  port: 3001
};

is done, it still uses 300

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions