Hey @services-faradaylabs. The problem you described seems to be related to local development instead of Vercel deployment.
I’m not very familiar with Hono. I think the team who develops the framework would know more about what’s going wrong in this case. I wouldn’t want to give you bad advice about it.
module is not missing: its right there. I cannot import any other file inside index.ts It’s not possible to write code in a single file. I’ve made a simple example - created new file near index.ts and it’s not found. Don’t have a clue what to do at all.
On the top right there will be an arrow button for downloading. After clicking - popup will appear, to sign in, but at the bottom of the popup there will be a download link.
Dropbox makes it harder to download zip files nowadays…
The zip file is a bit too large for me to download since node_modules were included, but I was able to take a look at the project structure at least.
I attempted to replicate it using Hono’s Next.js starter template (i.e. npm create hono@latest my-app and selected the nextjs option).
I added a /pages/api/test.ts file with export const myName = "Bob"; as its only contents. I added import { myName } from './test' to my /pages/api/[...route].ts file and ran vercel dev. I also updated the message to output the value of myName to be sure the import actually worked as expected.
When I visited http://localhost:3000/api/hello I saw the expected message. However, it also created an unnecessary extra serverless function. This is because all .js and .ts files in the /pages/api directory are automatically assumed to be serverless functions.
Next, I created a /utils folder and moved the test.ts file into it. I updated /pages/api/[...route].ts with import { myName } from '../../utils/test' to match the new file location. I visited http://localhost:3000/api/hello again running the updated code and got the same expected message.
Think is, I don’t know next.js - never worked with it. That’s why during project creation I didn’t select next.js template. I selected: vercel template right away.
After projet creation, I made changes which are shown for node.js. Scroll the page down , after point 4 Node.js:
I created a small example of a serverless function that imports another file from the same repo. It works if I include the .js file extension in my simple example. But some additional configuration is likely needed with Hono and TypeScript.
The Hono folks would know more about how the framework actually works and their recommended setup for what you’re trying to do with that starter project.