Below I will share with you an article that solves the problem of Webpack hot deployment not detecting file changes. It has a good reference value and I hope it will be helpful to everyone.
When I was developing with Webpack today, I suddenly found that the hot deployment function did not work after the file was changed. It felt like webpack could not detect the file modification. After struggling for a long time, I always thought there was a problem with my code. However, I accidentally restarted the machine and found that it could be hot-deployed again. It felt like I had seen a ghost. So continue to observe.
One day later, misfortune struck again, and the problem arose again.
After some research, it turns out that Webpack's hot deployment function uses inotify to monitor file changes, where fs.inotify.max_user_watches represents the number of watches that can be added by the same user at the same time (watches are generally for directories, which determines the number of watches that can be added by the same user at the same time). The number of directories that users can monitor)
Therefore, I checked the current max_user_watches value of the system
$ cat /proc/sys/fs/inotify/max_user_watches 8192
8192 is the default value. It may be that this value is too small, and the file directory under my app Too many, so I tried to modify it
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Check the modification result after modification
$ cat /proc/sys/fs/inotify/max_user_watches 524288
Okay, try modifying the result, and test the hot deployment function of webpack again, everything is normal .
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to implement global registration and local registration in vue components
How to implement custom global methods in vue
How to implement data interaction between sub-sibling components in Vue2.0
The above is the detailed content of Solve the problem of hot deployment not detecting file changes in Webpack. For more information, please follow other related articles on the PHP Chinese website!