...
/Exploring the Build Process and Customization
Exploring the Build Process and Customization
Learn how we can build projects in Astro and how to hook into different phases of the build process.
We'll cover the following...
Astro comes with its own build command that automatically optimizes Astro components for a production-ready environment. In this lesson, we’ll take a look at how to build an Astro project to create production-ready bundles and how to change build-related configurations.
Building the project
To build an Astro project, we can use the astro build
command. This command is automatically created for new Astro projects, so we can execute it by running npm run build
. Try building the project below by running npm run build
inside the terminal.
This command will build all pages into static HTML files that are generated into a dist
folder. We can change the build directory by specifying the outDir
property in our astro.config.mjs
file. Try updating the configuration file according to the following example and rerun the npm run build
command to verify that the bundle is generated into a different folder—called build
—at the root ...