Производственная сборка не создает уникальные хеши - Angular 9 - PullRequest
0 голосов
/ 29 января 2020

Angular производственная сборка не генерирует уникальные хэши в моем проекте.

Я понятия не имею, почему это не работает. Я прочитал все доступные источники об этой топике c и в соответствии с их решениями она должна работать, но это не так.

Я действительно смущен, пожалуйста, помогите.

Я также пытался

npm запустить ng build --prod --build-optimizer = false или

npm запустить ng build --prod --outputHashing = все --строить-оптимизатор

Подробнее:

enter image description here

Angular. json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ob3": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "aot": false,
            "outputPath": "wwwroot",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico",
              "src/environment.json"
            ],
            "styles": [
              "node_modules/devextreme/dist/css/dx.common.css",
              "node_modules/devextreme/dist/css/dx.light.css",
              "src/styles.scss",
              "src/ng2-select.scss",
              "node_modules/angular2-toaster/toaster.css",
              "node_modules/ngx-ui-switch/ui-switch.component.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "ob3:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "ob3:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "ob3:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [],
            "styles": [
              "src/styles.scss",
              "src/ng2-select.scss",
              "node_modules/angular2-toaster/toaster.css",
              "node_modules/ngx-ui-switch/ui-switch.component.css"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico",
              "src/environment.json"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "ob3-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "ob3:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "ob3",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}

Package. json:

{
  "name": "ob3",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/compiler": "9.0.0-rc.11",
    "@angular/localize": "^9.0.0-rc.0",
    "@angular/platform-browser": "9.0.0-rc.11",
    "@angular/platform-browser-dynamic": "9.0.0-rc.11",
    "@angular/router": "9.0.0-rc.11",
    "@ngx-translate/core": "^10.0.2",
    "@ngx-translate/http-loader": "^3.0.1",
    "@types/jest": "^24.0.11",
    "@types/mocha": "^5.2.6",
    "angular-calendar": "^0.25.2",
    "angular-draggable-droppable": "^3.0.1",
    "angular-oauth2-oidc": "^4.0.2",
    "angular-odata-es5": "^0.5.0",
    "angular2-virtual-scroll": "^0.4.9",
    "applicationinsights": "^1.1.0",
    "applicationinsights-js": "^1.0.19",
    "bootstrap": "^4.4.1",
    ...
  },
  "devDependencies": {
    "@agm/core": "^1.1.0",
    "@angular-builders/custom-webpack": "^8.4.1",
    "@angular-builders/dev-server": "^7.3.1",
    "@angular-devkit/architect": "^0.803.23",
    "@angular-devkit/build-angular": "~0.900.0-rc.10",
    "@angular/animations": "^9.0.0-rc.11",
    "@angular/cli": "^9.0.0-rc.10",
    "@angular/common": "^9.0.0-rc.11",
    "@angular/compiler-cli": "9.0.0-rc.11",
    "@angular/core": "^9.0.0-rc.11",
    "@angular/forms": "^9.0.0-rc.11",
    "@ng-bootstrap/ng-bootstrap": "^5.2.1",
    "@schematics/angular": "^8.3.23",
    "ajv": "^6.11.0",
    "angular2-toaster": "^8.0.0",
    "clean-webpack-plugin": "^3.0.0",
    "codelyzer": "^5.1.2",
    "fibers": "^4.0.2",
    "html-webpack-plugin": "^3.2.0",
    ...
  },
  "optionalDependencies": {
    "fsevents": "^2.1.2"
  }
}

tsconfig. json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "importHelpers": true,
    "module": "esnext",
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ],
    "paths": {
      "stream": ["./node_modules/stream-browserify/index.js"],
      "zlib": ["./node_modules/browserify-zlib/lib/index.js"]
    }
  }
}

csproj строк, отвечающих за сборку:

<Target Name="Build Angular" BeforeTargets="Build" DependsOnTargets="NodeInitialize">
    <Exec Command="npm run ng build --prod --build-optimizer" />
    <Delete Files="wwwroot/environment.json" />
  </Target>
...