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

后端 未结 10 573
无人及你
无人及你 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 12:04

    Caution: Angular 6 and above!


    For readers with an angular.json (not angular-cli.json) the key correct key is outputPath. I guess the angular configuration changed to angular.json in Angular 6, so if you are using version 6 or above you most likely have a angular.json file.

    To change the output path you have to change outputPath und the build options.

    example angular.json

    {
        "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
        "version": 1,
        "projects": {
            "angular-app": {
                "projectType": "application",
                [...]
                "architect": {
                    "build": {
                        "builder": "@angular-devkit/build-angular:browser",
                        "options": {
                            "outputPath": "dist/angular-app",
                            "index": "src/index.html",
                            "main": "src/main.ts",
                            [...]
    

    I could not find any official docs on this (not included in https://angular.io/guide/workspace-config as I would have expected), maybe someone can link an official resource on this.

提交回复
热议问题