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 to build in the current situation; for imported GitHub repositories, Pages will automatically identify the framework used by and apply the most common build configuration.
If you need specific settings, you can customize parameters such as root directory, build command, and output directory when creating a new project or in project settings.
You can start up Pages deployment through two methods:
Push code changes to GitHub.
Start up redeployment on the console.
Build Settings
You can specify how Pages builds your project in "Project Settings - Build deployment configuration".
Framework Preset
Select a 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 output directory for different frameworks through the Construction Guide.
Build 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.
Pages automatically detects the installation command during build and installs dependencies from package.json. The default is npm install.
Currently supports the following package managers:
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, 22.11.0, 22.17.1, and 24.5.0. You can select your preferred version in "project setting - Node.js Version".
Note:
The pre-installed Node Version includes package managers such as pnpm, yarn, and bun. If there is a .nvmrc file 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 variable can set a variable name, variable value, and remarks. Currently, these variables are valid for all environments.
If needed, you can paste ALL environment variables in the .env file within the variable name input frame. Pages will automatically identify them.
Note:
Any changes you make to environment variables will not affect earlier deployments. These changes are applicable only to new deployments.
The variable name has a length limit of 255 bytes, and the variable value has a length limit of 500 bytes.