Solve the problem that Webpack hot deployment cannot detect file changes.
Today, when I was using Webpack for development, I suddenly found that the hot deployment feature is not working after the file changes. It seems that webpack cannot detect file modifications. After a long time, I started to think that my code had a problem. As a result, I accidentally restarted the machine and found that I was able to perform hot deployment again. It seemed like a ghost. So continue to observe.
One day later, unfortunately, the problem came again.
According to the survey, the original hot deployment function of Webpack uses inotify to monitor file changes, among which fs. inotify. max_user_watches indicates the number of watches that a user can add at the same time (watch is generally used for directories and determines the number of directories that the same user can monitor at the same time)
Therefore, we checked the current max_user_watches value of the system.
$ Cat/proc/sys/fs/inotify/max_user_watches8192
8192 is the default value. It may be that this value is too small, and there are too many file directories in my app, so I tried to modify it.
Echo fs. inotify. max_user_watches = 524288 | sudo tee-a/etc/sysctl. conf & sudo sysctl-p
View the Modification result after modification.
$ Cat/proc/sys/fs/inotify/max_user_watches524288
Now, try modifying the results and test the hot deployment function of webpack again. Everything is normal.
The above article solves the problem that Webpack hot deployment cannot detect file changes, that is, all the content that I share with you. I hope to give you a reference and support for the help house.