Hot reloading STOP working on REACT v17 after adding “export const” out of App functional component

Viewed 83

I suddenly encounter this issue, until I found the cause.

I have putted an export const out of the scope of App functional component. After doing that – hot reloading stops to work.

You can see a demo of this in this Basic create-app project (compare it to the branch: hot-reload-now-not-working.

I saw this behavior also on another project. But with older project it didn’t happen. (when app is regular class component there).

Here is a video demonstrating

Is this a bug ?

package.json:

{
  "name": "draft-work-5781",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.5",
    "@testing-library/user-event": "^12.7.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.2",
    "web-vitals": "^1.1.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
0 Answers
Related