1

Typescript just relase 3.7.3 with optional chaining, so I wanted to upgrade a project for this feature.

However, after runing yarn upgrade --latest, and doing yarn start, the app will reload infinitely.

After couple days of debugging. This is what I find out, it seems like if anything changed recently on /public folder, then the app will be Navigated to http://localhost:3000/ which will cause it to reload infinitely due to the design of my app.

The project was working for previous dependencies, so I am not sure whethere it's a react or electron upgrade that they changed it such that the app will watch for /public folder. When public folder changed, and causing the app to navigate to localhost:3000. Anyone know what's the cause of this phenomena? And the reason behind this change, and also how to pass around this?

By the way, my app was a simple epub reader application. Currently, my app will load all the images, css files and stored them to public folder (delete those files on unmount). Thus the app can load these images, stylesheets. (I just tried to store these files just inside the src folder, and it seems react won't be able to load these resources dynamically).

Jiahua Zhang
  • 511
  • 7
  • 19
  • It seems like this pull request [Enable page reloading for files in `public/`](https://github.com/facebook/create-react-app/pull/1546/files) enabled react to reload application when it detects folder changed on `public` folder. To deliberately cancel this settting, changed [it](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpackDevServer.config.js#L62), to `watchContentBase: false`. Of course, this is not the recommended way doing so when it comes to change library file itself. I wish `react-scripts start` could give us more control of it (--options). – Jiahua Zhang Dec 12 '19 at 01:33

0 Answers0