Pauline P. Narvas Could you try the following? - Replace all path alias imports (`@/*`) with relative imports (`./` or `../`) - this is the most reliable fix - Use explicit file extensions in imports (`.ts`, `.tsx`) as Bun sometimes requires them Let us know how you get on!
Darkstar Hey, thanks for taking a look. Sorry for the delayed response. As I mentioned in my post, it will work fine if I remove the path alias and replace them all with relative imports. But I would like to know whether there is a way to get it to work with the path alias? Path alias is a very convinient thing. And I have used it a lot in the project I am trying to deploy. So going and replacing all those import calls with relative imports is a thing I would like to avoid if possible. Regarding your second option. It won’t work if the file extenions are `.ts` on Bun runtime. It will work if the file extension is `.js`. But for Bun it works even without the file extension as long as path alias is not used, so you don’t need to have any extension at all. As for the path alias making it break, is it a known limitation? Is it something planned to be fixed? Also, another question I have is, should I have some sort of build script? Since this is only a REST API built with Hono (no frontend code), I thought I will not need anything extra. Plus the official example doesn’t seem to have any build script either: https://github.com/vercel/examples/tree/main/framework-boilerplates/hono-bun I tried using the `bun build` command as a build script. So Vercel runs it when it runs `vercel build`. This way all my code gets bundled into one file in `/dist/app.js`, and there won’t be any path alias. And I get to keep the path alias in my source code. But this also breaks at runtime. It outputs the same error I have in my original post. I suspect in this case it’s because the build output is in `/dist/app.js` and Vercel doens’t find it? Because in the docs it says the only files that are supported are these:https://vercel.com/docs/frameworks/backend/hono#exporting-the-hono-application Because of that I tried ouputting the build output to a place like `/app.js`, but that didn’t work either. Same error. It’s bit hard to troubleshoot because build passes, and it only fails at runtime and I get the same error on all occasions. I am happy to share and clarify things further if something is not clear.
Darkstar I came across this: https://vercel.com/changelog/experimental-build-mode-hono-express The build mode that gets enabled by that environment variable seems to work fine with path alias. Both on Node and Bun. So basically, if you set that environment variable inside your Vercel project settings you can keep your path alias in the imports without any issues. I wonder whether it would be a good idea to link that changelog or document this behavior in a doc somewhere. Ideally here: https://vercel.com/docs/frameworks/backend/hono
system If you're having trouble deploying an Express app, this guide can help. https://vercel.com/guides/using-express-with-vercel You can also ask v0 for suggestions tailored to your own project setup.
Jayarbrul It looks like the issue is related to how Vercel bundles and deploys serverless functions, and it seems the app in the `/server` directory isn’t getting bundled correctly as part of the function in `/api`.
Pauline P. Narvas The module resolution system requires explicit file extensions in imports. Could you try adding file extensions to the imports? Like: ``` import { something } from './server/file.js' ```