【问题标题】:Angular. [HMR] Cannot apply update. Need to do a full reload角。 [HMR] 无法应用更新。需要完全重新加载
【发布时间】:2019-10-25 12:50:46
【问题描述】:

我将 HMR (stories configure hmr) 添加到我的 Angular 项目中,但热重新加载我正在完全重新加载。

更新到angular 8,问题没有解决。

[HMR] Cannot apply update. Need to do a full reload!
...
[HMR] Error: Aborted because ./node_modules/raw-loader/index.js!./src/app/components/tabs/remark/remark.component.html is not accepted
Update propagation: ./node_modules/raw-loader/index.js!./src/app/components/tabs/remark/remark.component.html -> ./src/app/components/tabs/remark/remark.component.ts -> ./src/app/app.module.ts -> ./src/main.ts -> 0
    at hotApply (http://localhost:4201/runtime.js:525:30)
    at http://localhost:4201/runtime.js:363:22
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:4201/polyfills.js:3516:26)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:4201/polyfills.js:3275:43)
    at http://localhost:4201/polyfills.js:4035:34
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4201/polyfills.js:3548:31)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:4201/polyfills.js:3320:47)
    at drainMicroTaskQueue (http://localhost:4201/polyfills.js:3726:35)
  1. 列表项

【问题讨论】:

  • 删除node_modules文件夹并运行此命令npm install再试一次。
  • 这个建议没有帮助
  • 你有延迟加载模块吗?
  • 不,我不使用。
  • 您解决了这个问题吗?

标签: angular hot-module-replacement


【解决方案1】:

我曾经这样运行我的应用程序 ng serve --hmr

一旦我开始使用 hmr 配置 ng serve -c hmr

HMR 开始工作。

您应该确保在 angular.jsonenvironment.ts 中启用了 hmr

【讨论】:

  • 根本没有帮助。我确信通过运行ng serve --hmr 是不可能得到有问题的错误的。因此,请编辑或删除您的答案。
猜你喜欢
  • 2016-10-03
  • 2018-12-20
  • 2017-06-24
  • 1970-01-01
  • 1970-01-01
  • 2020-09-30
  • 2019-02-18
  • 1970-01-01
  • 2017-04-09
相关资源
最近更新 更多