Build Guide
This chapter will introduce the build procedures for Pages deployment and its working principle.
When creating a project using a pre-set template, Pages will use the template's default configuration for the build; for imported GitHub repositories, Pages will automatically recognize the framework used and apply the most common build configuration.
If you need specific settings, you can customize parameters such as the root directory, build commands, and output directory when creating a new project or in the project settings.
You can start Pages deployment in two ways:
Push code changes to GitHub
Start redeployment in the console
Build Settings
You can specify how Pages builds your project in "Project Settings - Build deployment configuration".
Framework Presets
By selecting a preset framework from the dropdown menu, you can quickly populate each configuration item. After selecting a framework, you can still make adjustments to other configurations.
Root directory
The root directory is the path where the compilation command is executed. If not set, the default is the root directory of the repository
./
Output directory
The output directory is the path where the build artifacts (such as HTML files and static resources) are stored. This directory is relative to the root directory and defaults to
root ( / )
. You can refer to the Framework Guide for the output directory corresponding to different frameworks.
Compilation Command
Pages will automatically set the compilation command according to the selected framework, such as
npm run build
. The compilation command will run in the Bash shell, and you can also add Bash-compatible syntax.
For the compilation commands corresponding to different frameworks, please refer to the Framework Guide.
Installation Command
Pages will automatically detect the installation command during the build process and install dependencies from package.json. The default is
npm install
.
The currently supported package managers are as follows:
Package manager | Lock File | Installation Command | Supported Versions |
Yarn | yarn.lock | yarn install | 1 |
npm | package-lock.json | npm install | 8, 9, 10 |
pnpm | pnpm-lock.yaml | pnpm install | 6, 7, 8, 9 |
Node Version
Pages comes pre-installed with several Node versions: 14.21.3, 16.20.2, 18.20.4, 20.18.0, 22.11.0. You can select the desired one in "Project Settings - Node.js Version".
Note:
The pre-installed Node versions include package managers like pnpm, yarn, and bun. If there is a .nvmrc file in the project's root directory, it will automatically download and switch to the specified version, but without the corresponding package managers.
Environment variable
Pages supports using environment variables to build your project. Each environment variable consists of a variable name and a variable value. Currently, these variables are valid for all environments.
Any changes you make to the environment variables will not affect previous deployments. These changes will only apply to new deployments.
Note:
The variable name is limited to 255 bytes, and the variable value is limited to 500 bytes