[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Feedback](/c/feedback/8)

# Vercel deploys functions directly from sourcecode, BEFORE build step, which could be inflexible to devs

58 views · 1 like · 2 posts


Hmpthz (@hmpthz) · 2024-10-28 · ♥ 1

Hi Vercel Staff,
Sorry for the confusion from the [bug report](https://community.vercel.com/t/failed-to-deploy-functions-if-project-is-located-in-subdirectory-with-minimal-example-to-reproduce/1695/2) I created before.

At first, I thought this must an issue regarding monorepo or project root directory, given that there were a lot of similar issues in the community.
It turns out I didn't correctly understand how Vercel functions are deployed: it directly searchs through `/api` directory from the sourcecode to found any `.js`, `.cjs`, `.mjs`, `.ts` file and deploy each of them as a node runtime function.
In contrast, my previous workflow was to use bundle the entire backend into a single js file, and output it in build directory.

This behavior, IMHO, is really not flexible for developers that prefer a different project structure / workflow.

Since I already found out the solution, this issue is not on high priority. Bu t I genuinely hope the vercel team could address the need, maybe provide a second option in the future.

Thanks you!


Pauline P. Narvas (@pawlean) · 2024-11-06

Thanks for coming back with your thoughts, @hmpthz! :pray: Glad it's working now for you!