Does Netlify, or can Netlify support building functions (including on-demand builders) prior to running the main build command? Specifically I want to be able to call these functions from within the build, preferably in the same context they will deploy in. to help things like cache warming.
Currently, (AFAIK) build code that would utilize our API would always be talking to the current deploy, which is necessarily some previous build. Usually this isn’t a problem, but it’s certainly possible to naively push both new API changes and build code that relies on them, which means neither will build successfully. (at least this failure is idempotent )
A quick and dirty solution is to allow manually building and deploying just the functions, or to replicate the process via manual local build and pushing zip files, but that’s not ideal.
Another work-around is to host the API on a different instance, which has additional benefits but is a bit more to worry about.
But I think the simplest way to do it is just allow some functions to specify a prebuid
flag, or similar lifecycle options.