javascript - 本地开发中的Angular2慢速自动页面刷新 - Windows

标签 javascript node.js typescript angular

我是 angular2 的新手并关注 heros来自文档的教程。我在使用 angular2 时遇到了相当缓慢的开发体验。 angular2 大约需要 5 秒来检测文件中的更改,然后在接下来的 30-40 秒内重新加载页面。

[0] 8:08:12 PM - File change detected. Starting incremental compilation...
[0] app/hero-detail.component.ts(2,8): error TS1192: Module '"app/app.component"' has no default export.
[0] 8:08:16 PM - Compilation complete. Watching for file changes.
[1][BS] File changed: app\app.component.js
[1] [BS] File changed: app\hero-detail.component.js
[1] [BS] File changed: app\main.js
[1] 16.02.07 20:08:39 304 GET /./index.html (Unknown - 8551ms)
[1] 16.02.07 20:08:45 304 GET /./index.html (Unknown - 1145ms)
[1] 16.02.07 20:08:45 304 GET /node_modules/es6-shim/es6-shim.min.js (Unknown - 384ms)
[1] 16.02.07 20:08:45 304 GET /node_modules/systemjs/dist/system-polyfills.js (Unknown - 393ms)
[1] 16.02.07 20:08:45 304 GET /node_modules/angular2/bundles/angular2-polyfills.js (Unknown - 399ms)
[1] 16.02.07 20:08:46 304 GET /node_modules/systemjs/dist/system.src.js (Unknown - 906ms)
[1] 16.02.07 20:08:46 304 GET /node_modules/rxjs/bundles/Rx.js (Unknown - 911ms)
[1] 16.02.07 20:08:47 304 GET /node_modules/es6-shim/es6-shim.min.js (Unknown - 962ms)
[1] 16.02.07 20:08:47 304 GET /node_modules/systemjs/dist/system-polyfills.js (Unknown - 967ms)
[1] 16.02.07 20:08:47 304 GET /node_modules/angular2/bundles/angular2.dev.js (Unknown - 972ms)
[1] 16.02.07 20:08:47 304 GET /node_modules/angular2/bundles/angular2-polyfills.js (Unknown - 977ms)
[1] 16.02.07 20:08:48 304 GET /node_modules/systemjs/dist/system.src.js (Unknown - 1429ms)
[1] 16.02.07 20:08:48 304 GET /node_modules/rxjs/bundles/Rx.js (Unknown - 1431ms)

虽然这个时间可能看起来并不重要,但是当我必须定期更改并检查输出时,它开始累加。

关于 angular2 开发缓慢的任何建议..??

最佳答案

问题

问题不在于 angular2,而在于 Windows/Antivirus,因为它们由于所谓的安全措施而减慢了 node.js。

解决方案

  • 禁用 Windows Defender(或任何其他防病毒软件)的实时保护,因为它会变慢 Node .js
  • 以管理员身份运行控制台(或 gitbash,如果您使用它)
  • 使用 SSD 驱动器

终极解决方案

性能和 Node 模块未安装的持续问题迫使我完全放弃 Windows。而在我转向 mac 的那一天,node 和 Angular 开发体验WAY更好了,区别就像是黑夜和阳光灿烂的大白天。

更多详情

阅读 excellent answer了解更多详情。

关于javascript - 本地开发中的Angular2慢速自动页面刷新 - Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35255572/

相关文章:

node.js - 使用 aws nodejs sdk 发送电子邮件(使用 aws sdk nodejs 文档)

typescript - Visual Studio Code 中的自动 JSDoc 生成坏了?

javascript - 将我的自定义图标添加到 ionic 2 actionSheet 的按钮

typescript - 如何键入以防止 Typescript 中的返回值

javascript - twilio 发送短信在 meteor 中不起作用

javascript - 浏览器支持 Number.EPSILON 吗?

javascript - 这个 JavaScript 函数方法叫什么?

javascript - 来自 wordpress postmeta 表键的多个值

node.js - RealmDB 结果始终显示为空

wss - Node.js 和 wss ://