Create-react-app watch mode fails when file renamed or branch switched

Viewed 230

I'm using create-react-app (via craco) and during development I keep it running in the watch mode using react-scripts start (well, craco start to be precise). This refreshes the app when I modify code in real time.

However, when I rename a file (e.g. from Foo.js to Foo.tsx) or switch to a branch where some files were renamed, I get a compilation error (see below) and need to restart the script. This is problematic, because the boot time is significant on my machine, making me have to wait several minutes before I can start developing again.

Failed to compile.

./src/foo/bar/Baz.js
Error: ENOENT: no such file or directory, open 'xyz\src/foo/bar/Baz.js'

Is there a way for the watch script to recognise file renames or monitor the project directory for any filename changes? Perhaps some CRA or craco config, or plugin could achieve this?

0 Answers
Related