1

In my Angular.json file. I have

      "configurations": {
        "production": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": true,
          "extractCss": true,
          "namedChunks": false,
          "aot": true,
          "progress": true,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "2mb",
              "maximumError": "5mb"
            }
          ]
        }
      }

This is executed when i run ng build --prod

How can I create a new configuration e.g. dev ?

dota2pro
  • 7,220
  • 7
  • 44
  • 79

1 Answers1

1

Once you have added an environment configuration to angular.json you can build it by using the --configuration option. In your case ng build --configuration=development.

Ronald91
  • 1,736
  • 1
  • 15
  • 23
  • Thanks that was what i was looking for, is there any abbrevation like production has `--prod` – dota2pro Aug 21 '19 at 17:40
  • 2
    If this is all you're looking for just add a line to your "scripts" in the package.json so you could for instance just say `npm (or yarn) boom` and it would run `"scripts": { "boom": "ng build --c=development"}` – Chris W. Aug 21 '19 at 17:42