각 사용 환경 변수와 환경 변수 배포

  • 환경 변수를 사용하여
    • Node.js를 환경 변수 process.env.mdsp_osbar_url 상기 실시 예에서 판독 할 수있다
    • 환경 변수를 운영 환경을 판독 (또는 클라우드 파운드리, 운영 체제)에 더하여 수도 또한 환경 변수를 판독 Node.js를
    • 글로벌 수준, 사용자 수준, 말기에 Node.js를 자신의 환경 변수
  • 환경 변수 배포를 사용하여
    • 각도 각 프로젝트는 environment.ts와 다른 환경에 배포 할 때 두 개의 파일 만 생산을 기본 다른 구성에 저장됩니다 environment.prod.ts있는 아래 디렉토리 환경을 가지고 : 사실
    • 루트 아래의 src 디렉토리 .angular-cli.json의 파일은 모든 CLI 명령 각도 구성입니다
      • .angular-cli.json 입구는 기본 프로그램 파일 이름 노드 애플리케이션에 제공된다
      • .angular-cli.json 환경 노드 연관된 애플리케이션에 배치 된 입구를 구비
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico",
        {
          "glob": "**/*",
          "input": "./node_modules/sinint-application-core-spa/assets/icons/",
          "output": "./src/assets/icons/"
        }
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "./assets/css/default.theme.css",
        "styles.scss"
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.min.js",
        "../node_modules/jqueryui/jquery-ui.js"
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ]
* src根目录下的这个**main.ts**文件,其中会在production值为true时才**enableProdMode()**,这个值会让编译结果不同,提高性能,关掉些功能?
import { enableProdMode } from '@angular/core';

import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

추천

출처www.cnblogs.com/wyp1988/p/11314345.html