Search code examples
angularangular-clitsconfig

Where to specify delete-output-path?


I have a Node Express project with Angular added through Angular CLI, ie ng new.

I do not want the Angular output to wipe out the distribution folder.

I understand there is a delete-output-path parameter that can be put on the command line to ng build.

Is it possible to put this in angular-cli.json?

Or should it be in tsconfig.json? Under which property?


Solution

  • Yes, you can. You have to put it under defaults property of .angular-cli.json like this:

    {
      "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
      "project": {
        "name": "project-name"
      },
      "apps": [
        {// app property values here}
    
      ],
      "e2e": {
        "protractor": {
          "config": "./protractor.conf.js"
        }
      },
      "test": {
        "karma": {
          "config": "./karma.conf.js"
        }
      },
      "defaults": {
        "styleExt": "scss",
        "component": {},
        "serve": {
          "port": 3000
        },
        "build": {
          "deleteOutputPath": false
        }
      }
    }
    

    If you want to learn more about this file's structure, you can go here

    Hope it helps :)