This chapter will introduce the build step of Pages deployment and how it works.
When creating a project, Pages will use the default configuration of the preset template for build. For imported GitHub repositories, Pages will automatically identify the framework used and apply the most common build configuration.
If you need specific settings, you can customize the root directory, build command, and output directory parameters such as when creating a new project or in project settings.
You can start up Pages deployment in two ways:
Push code changes to GitHub
Start redeploy on the console
Build Settings
You can specify how Pages builds your project in "Project Settings - Build deployment configuration".
Framework Preset
Select the preset framework from the pull-down menu to quickly fill each configuration item. After selecting the framework, you can still adjust other configuration.
Root Directory
The root directory is the path to execute the build command. If not set, it defaults to the repository's root directory ./.
Output Directory
The output directory is the path for storing build artifacts (such as HTML files and static resources). This directory is relative to the root directory and defaults to root ( / ). You can query the corresponding output directory for different frameworks through the Framework Guide.
Command
Pages automatically configures the build command based on the selected framework, such as npm run build. The build command runs in the Bash shell. You can also add Bash-compatible syntax.
For build commands of different frameworks, see Framework Guide.
Installation Command
Pages automatically detects the installation command during build and installs dependencies from package.json. Defaults to npm install.
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 preinstalled with node Versions 14.21.3, 16.20.2, 18.20.4, 20.18.0, and 22.11.0. You can select them in "Project Setting - node Version".
Note:
The pre-installed node Version includes package managers such as pnpm, yarn, and bun. If a .nvmrc file exists in the project root directory, it will automatically download and switch to the specified version, excluding the appropriate package manager.
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.
To batch import environment variables, paste all environment variables from .env into the variable name input field. Pages will automatically identify them.
Note:
Any changes you make to environment variables will not affect previous deployments. These changes are applicable only to new deployments.
The variable name length limit is 255 bytes, and the variable value length limit is 500 bytes.