Solve the problem that Webpack hot deployment cannot detect file changes.

Source: Internet
Author: User
Tags inotify

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.