Where to specify delete-output-path?

瘦欲@ 提交于 2019-12-10 23:40:25

问题


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?


回答1:


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 :)




回答2:


For Angular CLI 6+ you have to edit angular.json file. You have to set deleteOutputPath false in build options

"architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "../dist",
        "deleteOutputPath": false,   <--------------------------- put here
        "index": "src/index.html",


来源:https://stackoverflow.com/questions/49607197/where-to-specify-delete-output-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!