Domain Expansion
Domain Expansion is an Astro integration that adds support for incremental builds. Basically, builds go weee now.
Benchmarks
Here’s how Domain Expansion performs against the default Astro build, both in a cold and hot build scenario.
- With Domain Expansion enabled, subsequent builds (with cache)
- With Domain Expansion enabled, initial build
- Without Domain Expansion
You can read more about the benchmarks in the benchmarks README on our GitHub repository.
Basically - the bigger the site, the more you’ll see Domain Expansion shine. You can read more about the trade-offs on the caveats page.
Installation
The Domain Expansion integration can be installed from npm using the following command:
This will install the integration and add it to your astro.config.mjs
.
Manual Installation
Install the @domain-expansion/astro
package using your package manager of choice:
Import and use the integration in your astro.config.mjs
:
Usage
Once the integration has been included in your astro.config.mjs
, the next time you build your site,
your build will be cached. From that point on, whenever you rebuild your site, only the files that have
changed will be rebuilt.
When to use
Use this when you have big, and we mean BIG Astro sites. You’ll see diminishing returns on smaller sites.
Even more optimization
Pray that Rolldown gets released soon. It’s current version, Rollup, accounts for about 90% of the build time for subsequent builds.