如果“ng serve”正在运行,则站点不会自动重新加载

时间:2018-01-10 10:32:27

标签: angular webpack reloading

我尝试了很多在线解决方案,但都没有。我的问题是,当我更改文件中的任何内容时,浏览器不会重新加载页面。以下是我项目的配置

Angular: 4.3.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped

@angular/cli: 1.6.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0

这是我的Package.json文件

{
"name": "start-ng",
"version": "1.1.1",
"license": "MIT",
"scripts": {
 "ng": "ng",
 "start": "ng serve",
 "build": "ng build",
 "test": "ng test",
 "lint": "ng lint",
 "e2e": "ng e2e"
},
"private": true,
"dependencies": {
  "@agm/core": "1.0.0-beta.0",
  "@angular/animations": "4.4.6",
  "@angular/common": "4.4.6",
  "@angular/compiler": "4.4.6",
  "@angular/core": "4.4.6",
  "@angular/forms": "4.4.6",
  "@angular/http": "4.4.6",
  "@angular/platform-browser": "4.4.6",
  "@angular/platform-browser-dynamic": "4.4.6",
  "@angular/router": "4.4.6",
  "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.28",
  "@ngtools/webpack": "^1.9.3",
  "@swimlane/ngx-charts": "6.0.0",
  "@swimlane/ngx-datatable": "9.3.1",
  "angular-2-dropdown-multiselect": "1.5.3",
  "angular-calendar": "0.19.0",
  "angular-in-memory-web-api": "0.3.2",
  "angular-resizable-element": "^1.1.1",
  "bootstrap": "4.0.0-alpha.6",
  "classlist.js": "1.1.20150312",
  "core-js": "2.4.1",
  "d3": "4.10.0",
  "date-fns": "1.28.5",
  "enhanced-resolve": "3.3.0",
  "flag-icon-css": "2.8.0",
  "font-awesome": "4.7.0",
  "intl": "1.2.5",
  "jquery": "3.2.1",
  "leaflet-map": "0.2.1",
  "ng2-ckeditor": "1.1.9",
  "ng2-completer": "1.6.0",
  "ng2-dragula": "1.5.0",
  "ng2-select": "^2.0.0",
  "ng2-smart-table": "1.2.1",
  "ng2-validation": "4.2.0",
  "ngx-pagination": "3.0.1",
  "ngx-perfect-scrollbar": "4.5.2",
  "ngx-toastr": "^5.2.4",
  "tether": "1.4.0",
  "web-animations-js": "2.3.1",
  "widgster": "0.0.3",
  "zone.js": "0.8.14"
},
"devDependencies": {
  "@angular/cli": "1.6.3",
  "@angular/compiler-cli": "4.4.6",
  "@angular/language-service": "4.4.6",
  "@types/jasmine": "2.5.53",
  "@types/node": "8.0.16",
  "codelyzer": "3.1.2",
  "file-loader": "^1.1.6",
  "jasmine-core": "2.6.4",
  "jasmine-spec-reporter": "4.1.1",
  "karma": "1.7.0",
  "karma-chrome-launcher": "2.2.0",
  "karma-cli": "1.0.1",
  "karma-coverage-istanbul-reporter": "1.3.0",
  "karma-jasmine": "1.1.0",
  "karma-jasmine-html-reporter": "0.2.2",
  "protractor": "5.1.2",
  "rxjs": "^5.5.6",
  "ts-node": "3.3.0",
  "tslib": "1.7.1",
  "tslint": "5.5.0",
  "typescript": "^2.3.4"
 }
}

我已经完成了大部分解决方案,但仍然没有得到任何帮助。它工作正常,直到昨天,但今天当我开始它,它没有重新加载任何更改,事实上我只在html和scss文件中进行了更改。

1 个答案:

答案 0 :(得分:5)

我通过添加带服务的命令来解决此问题。

ng serve --poll=2000