Home > Web Front-end > JS Tutorial > body text

Solve the problem of hot deployment not detecting file changes in Webpack

亚连
Release: 2018-06-05 15:09:56
Original
1644 people have browsed it

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
Copy after login

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
Copy after login

Check the modification result after modification

$ cat /proc/sys/fs/inotify/max_user_watches
524288
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!