简体   繁体   English

调试react-hot-loader Webpack样板

[英]Debugging react-hot-loader webpack boilerplate

I have been trying to get a ReactJS Hotloader working. 我一直在尝试让ReactJS Hotloader工作。

Specifically, even this boilerplate demo does not work for me: I run npm start , I see "hello world" text in my browser, I see "[WDS] Hot Module Replacement enabled" in my browser console, but when I edit and save the 'hello world' text in App.js the changes are not auto-rendered. 具体来说,即使这个样板演示对我也不起作用:我运行npm start ,在浏览器中看到“ hello world”文本,在浏览器控制台中看到“ [WDS] Hot Module Replacement enabled”,但是当我编辑并保存时App.js中的“ hello world”文本不会自动呈现更改。

In this troubleshooting page , I fall under this category: 在此故障排除页面中 ,我属于以下类别:

I see “[WDS] Hot Module Replacement enabled” but nothing happens when I edit App.js 我看到“已启用[WDS]热模块替换”,但是在编辑App.js时没有任何反应

If you're running Node 0.11.13, you might want to try updating to 0.12. 如果您正在运行Node 0.11.13,则可能要尝试更新到0.12。 Some people reported this helped solve this problem. 有人报告这有助于解决此问题。 Also make sure that your requires have the same filename casing as the files. 此外,请确保您的要求与文件具有相同的文件名大小写。 Having App.js and doingrequire('app') might trip the watcher on some systems. 在某些系统上,拥有App.js和doingrequire('app')可能会使观察者绊倒。

OS X also has a rarely-occuring bug that causes some folders to get 'broken' with regards to file system change monitoring. OS X还具有一个很少发生的错误,该错误导致某些文件夹在文件系统更改监视方面被“破坏”。 Here are some suggested fixes. 这是一些建议的修复程序。

I am running Node 5.6.0 on OSX. 我在OSX上运行Node 5.6.0。 I am only trying the boilerplate code from the repository linked above, so the filename casing is all the same as the files. 我只是尝试从上面链接的存储库中获得样板代码,因此文件名的大小写与文件相同。 I have tried restarting my machine. 我尝试重新启动机器。

Anything else I could try to get React hot-loading working? 我还能尝试让React热加载工作吗? Thanks! 谢谢!

Eureka! 尤里卡! After many weeks of this causing trouble, I discovered that the issue was related to me backing up my code using Dropbox desktop. 经过数周的麻烦之后,我发现问题与我使用Dropbox桌面备份代码有关。 Perhaps Dropbox change syncing was conflicting with Webpack polling, or something of that sort. 也许Dropbox更改同步与Webpack轮询或类似问题冲突。

Hope this will spare someone else the frustration I went through! 希望这可以避免别人遭受我的挫败感!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM