Angular multi-environment configuration problem

now we need two online environments that are not quite clear about how to configure
Bar. The part of the configuration is posted in the hope that God will advise
package.json

.
{
  "scripts": {
    "build": "ng build --prod",
    "deploy": "ng build --prod --polyfills src/deploy.ts --output-path dist-deploy",
    "serve": "ng serve"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.8",
    "@angular/animations": "6.1.7",
    "@angular/cli": "6.2",
    "@angular/common": "6.1.7",
    "@angular/compiler": "6.1.7",
    "@angular/compiler-cli": "6.1.7",
    "@angular/core": "6.1.7",
    "@angular/forms": "6.1.7",
    "@angular/http": "6.1.7",
    "@angular/language-service": "6.1.7",
    "@angular/platform-browser": "6.1.7",
    "@angular/platform-browser-dynamic": "6.1.7",
    "@angular/router": "6.1.7",
    "core-js": "2.5",
    "echarts": "4.1",
    "moment": "2.22",
    "ng-zorro-antd": "1.6",
    "rxjs": "6.3",
    "typescript": "2.9",
    "zone.js": "0.8"
  }
}

angular.json

{
  "projects": {
    "app": {
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "configurations": {
            "production": {
              "aot": true,
              "buildOptimizer": true,
              "extractCss": true,
              "extractLicenses": false,
              "namedChunks": false,
              "optimization": true,
              "outputHashing": "all",
              "polyfills": "src/prod.ts",
              "sourceMap": false,
              "vendorChunk": false
            }
          },
          "options": {
            "assets": [
              "public"
            ],
            "index": "public/index.html",
            "main": "src/main.ts",
            "outputPath": "dist",
            "styles": [
              "src/styles/index.scss"
            ],
            "tsConfig": "tsconfig.json"
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "app:build",
            "hmr": true,
            "hmrWarning": false,
            "host": "0.0.0.0",
            "open": true,
            "port": 8100,
            "proxyConfig": "proxy.config.js"
          }
        }
      },
      "projectType": "application",
      "root": "",
      "sourceRoot": "public"
    }
  },
  "version": 1
}

main.ts

import { registerLocaleData } from "@angular/common";
import zh from "@angular/common/locales/zh";
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import "core-js/es7/reflect";
import "zone.js/dist/zone";

import { AppModule } from "./app/app.module";
import "./prod";

platformBrowserDynamic().bootstrapModule(AppModule);
registerLocaleData(zh);

prod.ts

import { enableProdMode } from "@angular/core";

enableProdMode();

window["baseUrl"]="http://yanduapi.t.oc1.xyz/v1"

deploy.ts

import { enableProdMode } from "@angular/core";

enableProdMode();

window["baseUrl"]="http://yanduapi.t.oc1.xyz/v2"

but now the base address of the yarn deploy interface is still v1, not the v2 set in deploy
where else to modify, how to modify it

Apr.06,2022
Menu