Including license file in production only environment using angular-cli

Viewed 3897

I use a third party library in my project. The third party library provides two licenses. A development license and a production license. The license files are java script files.

I use anglular-cli to build my project.

Obviously I want my development builds to be fired with development license. However when the production build is fired (--prod flag), I want the production license to be bundled. Would like to know how to do this.

Below are my environment details

@angular/cli: 1.2.0
node: 6.10.3
os: win32 x64

As seen below in the .angular-cli.json file, license is included in the scripts section

"scripts": [
      "./assets/js/cloak.js",
      "../license.js"

Below is my complete .angular-cli.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "cricinfo-ui"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico",
        "cloak.json",
        "environment.json",
        "cricinfo.png"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [
      "./assets/js/cloak.js",
      "../license.js"

      ],"environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}
1 Answers
Related