【问题标题】:Angular 2 and npm start: How to change polling interval?Angular 2 和 npm start:如何更改轮询间隔?
【发布时间】:2017-09-28 02:37:59
【问题描述】:

我正在学习 Angular 2 教程 (https://angular.io/guide/quickstart) 并使用 npm start 观察 TypeScript 文件,并在它们发生变化时自动转译和重新加载内置的 Web 服务器。

它工作正常,但似乎有很多滞后。有时它可能需要 10 秒钟才能注意到文件已更改。一旦看到更改,它就会非常快速地编译和重新加载。

有谁知道是否有办法将轮询间隔设置为更快?

我查看了 npm start 和并发模块的文档,但我找不到任何记录在案的设置来更改它。

这是我的 package.json:

{
  "name": "myapp",
  "version": "0.1.0",
  "scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
    "test": "live-server --open=src/unit-tests.html"
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.0",
    "systemjs": "0.19.6",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "zone.js": "0.5.10"
  },
  "devDependencies": {
    "concurrently": "^1.0.0",
    "jasmine-core": "2.4.1",
    "lite-server": "^1.3.1",
    "typescript": "^1.7.3"
  }
}

【问题讨论】:

    标签: angularjs node.js npm


    【解决方案1】:

    这是 1.7.4+ 版本的 typescript 错误。

    package.json 中,写入"typescript": "1.7.3",然后执行npm update 以安装该版本。

    【讨论】:

    • 这有很大的不同。它现在几乎可以立即看到变化。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2016-09-24
    • 2017-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-31
    相关资源
    最近更新 更多