Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outdated poll option for webpack watcher #12397

Open
dimitriylol opened this issue May 13, 2022 · 1 comment
Open

outdated poll option for webpack watcher #12397

dimitriylol opened this issue May 13, 2022 · 1 comment

Comments

@dimitriylol
Copy link

Describe the bug

The troubleshooting documentation mentions the usage of CHOKIDAR_USEPOLLING=true in case webpack watcher doesn't detect files changes. The latest webpack version (5.72.1) doesn't use chokidar to detect source file changes. It uses its own package watchpack that doesn't support CHOKIDAR_USEPOLLING variable. It has WATCHPACK_POLLING variable for it.

Did you try recovering your dependencies?

Yep, it doesn't change the dependency tree (create-react-app => react-scripts => webpack => watchpack).

Which terms did you search for in User Guide?

N/A

Environment

N/A

Steps to reproduce

N/A

Expected behavior

Updated documentation that mentions WATCHPACK_POLLING in case of troubles with webpack watcher. I'm not sure that CHOKIDAR_USEPOLLING is completely outdated. I found chokidar usage in webpack-dev-server to track public files so I assume they aren't fully migrated from chokidar.

Actual behavior

Setting CHOKIDAR_USEPOLLING variable isn't enough to enforce polling of webpack watcher.

Reproducible demo

I got the problem with webpack watcher during using NFS. Apparently, inotify that fires events on file updates doesn't work with NFS. I couldn't create simple steps to reproduce the issue.

@S-C-Johnston
Copy link

@dimitriylol thank you!

Can confirm, as of 2023-06-11 using the latest create-react-app script to init the project, setting WATCHPACK_POLLING=true by some means (direct environment export, .env, whatever) gets the npm start invocation working as expected


For anyone else coming into this, I also recommend setting in the react-scripts/config/webpack.config.js module.exports to include the object

watchOptions: {
    ignored: ['**/node_modules']
}

so that polling doesn't hammer your cpu with a bunch of files that are not going to change. (https://webpack.js.org/configuration/watch/#watchoptionsignored)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants