Watcher doesn’t see a new file until restart

Do you want to request a feature or report a bug?


What is the current behavior?

Consider this project:


  "scripts": {
    "start": "webpack --watch src/index.js dist/bundle.js"
  "devDependencies": {
    "webpack": "^3.10.0"


import x from './x';


export default 42;

Then do this series of steps:

  1. Run npm install.
  2. Run npm start.
  3. Delete src/x.js.
  4. Create src/x folder.
  5. Create src/x/index.js with same content as src/x.js used to have.

What is the expected behavior?

Webpack recovers from a “not found” error. At the very least after re-saving either src/index.js or src/x/index.js.

Actual behavior is that Webpack gets stuck insisting ./x is not found, and the only way to fix it is by restarting the watcher.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

OS X Sierra, Node 8.9.1 (but it’s an old issue, existed at least since 2016 facebook/create-react-app#1164).

I couldn’t figure out how to correctly set up Webpack beta so I didn’t test that.

Author: Fantashit

2 thoughts on “Watcher doesn’t see a new file until restart

  1. Is there any middle ground or a heuristic we could use? For example, if a file is not found, then invalidate any cache entries around it on any FS event.

Comments are closed.