how to change the dist-folder path in angular-cli after 'ng build'

后端 未结 10 571
无人及你
无人及你 2020-12-07 11:27

I would like to use angular-cli with asp.net core and I need to know how I can change the path of the dist folder

10条回答
  •  臣服心动
    2020-12-07 11:55

    Angular CLI now uses environment files to do this.

    First, add an environments section to the angular-cli.json

    Something like :

    {
      "apps": [{
          "environments": {
            "prod": "environments/environment.prod.ts"
          }
        }]
    }
    

    And then inside the environment file (environments/environment.prod.ts in this case), add something like :

    export const environment = {
      production: true,
      "output-path": "./whatever/dist/"
    };
    

    now when you run :

    ng build --prod
    

    it will output to the ./whatever/dist/ folder.

提交回复
热议问题