On-demand Builders are serverless functions used to generate web content on-demand that is automatically cached on Netlify’s Edge CDN. They enable you to build the pages for your site when a user visits them for the first time and cache them at the edge for subsequent visits.
To learn more, read the blogpost or visit our docs. We’d love to hear your feedback!
Hey there, @lisatjide
All frameworks can use On-demand Builders. Thanks for checking!
How will onPostBuild hooks work, for plugins?
@marcellothearcane Because Build Plugins and the
onPostBuild event handler rely on the Netlify build system, they can’t be used in On-Demand Builders. However, the main purpose of having an event like
I’ll admit, though, coding your own multi-step On-Demand Builder function is not as easy as clicking a button to install a plugin and having it do its thing. In the end, the most featureful way to build site pages and assets is in Netlify’s regular build & deploy lifecycle. If your site isn’t huge, that’s usually what works best. It’s more when you get into really, really large scale that you would consider the trade-offs of deferring some pages to build later with an On-Demand Builder.
Thanks for your reply! I ask, because I wrote a plugin (netlify-plugin-csp-generator), and was wondering what I’ll need to change in order to support on-demand builders.
If I understand correctly, it may be possible to make a separate ‘plugin’ that could be used by an on-demand builder, kind of like how Express handles middleware - does that sound right? Though I expect there’ll be time limits like your edge handlers, so that might not always be feasible.
I’ll just say ‘not supported’ for the time being, and see if there is any demand in the future. It’s not like my plugin is widely used!
Ah, good question, @marcellothearcane! The does seem like a tricky one, especially because the
_headers file wouldn’t do anything by the time an On-demand Builder runs, either.