-
-
Notifications
You must be signed in to change notification settings - Fork 882
Description
What version of Hono are you using?
4.5.1
What runtime/platform is your app running on?
vercel
What steps can reproduce the bug?
I’m trying to create a simple Vercel function running on a node environment using the Hono framework.
Using these steps: https://hono.dev/docs/getting-started/vercel
`npm create hono@latest my-app
npm i`
instead of “npm run dev” I must call “npm run start,” not according to Hono documentation, strange.
npm i @hono/node-server
replacing handle from
import { handle } from 'hono/vercel’ to
import { handle } from “@hono/node-server/vercel”;
Creating .env file and adding: NODEJS_HELPERS=0
Also adding to package.json “type”: “module”
starting the server: npm run start
opening the browser: http://localhost:3000/api and seeing “{“message”:“Hello Hono!”}”
Everything looks great.
Now I’m adding the test.ts file into /api
Contents: export const myName = "Bob";
In /api/index.ts changing
return c.json({ message: "Hello Hono!" });
to
return c.json({ message: Hello ${myName} });
and adding
import { myName } from "./test";
starting the server: npm run start
no errors
Opening in browser: http://localhost:3000/api
and getting the error: Error: Cannot find module ‘…\test\vercel\my-app\api\test’ imported from …\test\vercel\my-app\api\index.ts
Just stuck for a whole day and don't know what to do next.
Any help is greatly appreciated.
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
source code: https://github.com/Bobetti/vercel-test