Skip to content

outdated poll option for webpack watcher #12397

Open

Description

@dimitriylol

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.

Activity

  1. S-C-Johnston commented on Jun 20, 2023

    @S-C-Johnston

    @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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions