Understanding build types
Gatsby version 4 introduced the ability for your website to be built in two different ways:
- As a static build: This creates all your pages at build time using Node.js. The resulting files are all static HTML, JavaScript, and CSS, which can be served entirely statically.
- As a hybrid build: This is a mixture of a static build combined with pages that are server-side rendered or have been created via deferred static generation.
When running gatsby build
, Gatsby will inspect your site's content, and if possible, create a static build. However, if your site contains pages that are server-side rendered or have been created via deferred static generation, it will create a build that requires server-side code that runs on a Node.js server or via serverless functions. Builds of both types can be tested locally using the gatsby serve
command.
Before deploying your build, it's worth ensuring that everything is working as it should locally...