我正在学习 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"
}
}
最佳答案
这是 1.7.4+ 版本中的一个 typescript 错误。
在package.json
中,写入"typescript": "1.7.3"
,然后执行npm update
来安装该版本。
关于angularjs - Angular 2 和 npm start : How to change polling interval?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34823872/