ng build --configuration=staging
ng server --configuration=staging
确保您在环境文件夹中创建一个environment.staging
文件,并修改该angular.json
文件以允许此命令。
"build": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"staging": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.staging.ts"
}
]
}
}
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "letsfarm-frontend:build"
},
"configurations": {
"production": {
"browserTarget": "letsfarm-frontend:build:production"
},
"staging": {
"browserTarget": "letsfarm-frontend:build:staging"
}
}
},