Angular 6 好久没刷新

Angular 6 Really Long Time to Refresh

我的应用程序出现问题并刷新。

我正在使用 angular-cli 6 构建我的应用程序,我正在使用 iis 作为服务器。

当我 运行 'ng build --watch' 刷新浏览器时,我有 10 秒的等待时间才能显示应用程序。

在 Chrome 调试器中,在性能方面,我在 "Scripting" 中有 8 秒。

我的package.json:

  {
      "name": "front",
      "version": "0.0.0",
      "license": "MIT",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build --watch",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "prod": "ng build --prod --aot"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "5.2.1",
        "@angular/cdk": "5.2.1",
        "@angular/common": "^5.2.1",
        "@angular/core": "^5.2.1",
        "@angular/flex-layout": "5.0.0-beta.13",
        "@angular/forms": "5.2.1",
        "@angular/http": "5.2.1",
        "@angular/material": "5.2.1",
        "@angular/platform-browser": "5.2.1",
        "@angular/platform-browser-dynamic": "5.2.1",
        "@angular/router": "5.2.1",
        "angular-calendar": "^0.22.3",
        "angular-draggable-droppable": "^3.0.1",
        "angular-moment-timezone": "1.7.1",
        "bootstrap": "^3.3.7",
        "core-js": "^2.5.3",
        "date-fns": "^1.29.0",
        "hammerjs": "^2.0.8",
        "jquery": "^3.3.1",
        "material-design-icons": "^3.0.1",
        "moment": "^2.20.1",
        "rxjs": "^5.5.6",
        "zone.js": "^0.8.20"  
      },
      "devDependencies": {
        "postcss-custom-properties": "^7.0.0",
        "node-sass": "^4.9.3",
        "@angular/compiler": "^5.2.1",
        "@angular-devkit/build-angular": "^0.7.5",
        "@angular-devkit/core": "0.3.2",
        "@angular/cli": "^6.1.1",
        "@angular/compiler-cli": "^5.2.1",
        "@angular/language-service": "^5.2.1",
        "@angular/material-moment-adapter": "5.2.1",
        "@types/jasmine": "~2.5.53",
        "@types/jasminewd2": "~2.0.2",
        "@types/node": "^6.0.96",
        "autoprefixer": "^7.2.3",
        "circular-dependency-plugin": "^4.2.1",
        "clean-webpack-plugin": "^0.1.19",
        "codelyzer": "^4.1.0",
        "copy-webpack-plugin": "~4.4.1",
        "cssnano": "^3.10.0",
        "file-loader": "^1.1.5",
        "html-webpack-plugin": "^2.29.0",
        "istanbul-instrumenter-loader": "^3.0.0",
        "jasmine-core": "~2.6.2",
        "jasmine-spec-reporter": "~4.1.0",
        "karma": "~1.7.0",
        "karma-chrome-launcher": "~2.1.1",
        "karma-coverage-istanbul-reporter": "^1.2.1",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "less-loader": "^4.0.5",
        "postcss-import": "^11.0.0",
        "postcss-loader": "^2.0.10",
        "postcss-url": "^7.1.2",
        "protractor": "~5.1.2",
        "raw-loader": "^0.5.1",
        "sass-loader": "^6.0.6",
        "source-map-loader": "^0.2.0",
        "style-loader": "^0.19.1",
        "stylus-loader": "^3.0.1",
        "ts-node": "~3.2.0",
        "tslint": "~5.7.0",
        "typescript": "2.6.2",
        "uglifyjs-webpack-plugin": "^1.1.8",
        "url-loader": "^0.6.2"
      },
      "peerDependency": {
        "angular-calendar": "^0.22.3"
      }
    }

类似问题:

我使用了 --poll 选项

示例:

--poll 5000 for 5 seconds

无头模式/无 GUI(速度更快)

ng test --no-progress --browsers=ChromeHeadlessCI --code-coverage --poll 5000

希望对您有所帮助。