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-appnpm iinstead of "npm run dev" I must call "npm run start," but this is Hono problem.
npm i @hono/node-server
replacing handle from "import { handle } from 'hono/vercel'" to "import { handle } from "/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: 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
