ng使用特定配置进行构建

时间:2019-06-06 00:18:16

标签: angular visual-studio-code

[更新]
这似乎仅在VS Code终端中发生,从控制台窗口开始,它按预期运行!嗯

ng run build-dev正常

ng运行build-prod但是没有。我想念什么?

我在运行build-prod命令时得到了这个

  

无法确定命令的项目或目标。错误:无法   确定命令的项目或目标。

在我的project.json中,我在脚本部分中有这个

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build-dev": "ng build --prod=false --configuration=dev",
    "build-qa": "ng build --prod=false --configuration=qa",
    "build-prod": "ng build --prod=true --configuration=prod",
    "build:ssr": "ng run Dflood.Genesys.Web.App:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },

在我的angular.json中,我在配置部分中有这个

 "configurations": {
            "prod": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            },
            "dev": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.dev.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            },
            "qa": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.qa.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },

0 个答案:

没有答案