Skip to content

V10 dev breaks React Fast Refresh on Gatsby sites #4569

@nonAlgebraic

Description

@nonAlgebraic

Describe the bug

Since version 10, using netlify-cli in a Gatsby project and serving the site in develop mode locally using netlify dev seems to break React Fast Refresh/hot reloading in the browser. Hot reloading still works fine when browsing the site via the underlying Gatsby dev server instead of netlify-cli's.

Expected behavior

Making a change to a React component in the source code automatically updates the rendered markup on the website in local develop mode, thanks to React Fast Refresh/hot reloading.

Observed behavior

When accessing the local develop site via netlify-cli's dev server (i.e., via localhost:8888 rather than localhost:8000) hot reloading does not work at all.

Steps to reproduce

  1. Clone this minimal reproduction repo, and run npm install.
  2. Run npm start to start the netlify-cli dev server.
  3. Change something, like JSX, in src/pages/index.js.
  4. Observe that it does not hot-reload in the browser.
  5. Browse to http://localhost:8000 (the underlying Gatsby dev server).
  6. Try again; observe that Fast Refresh is working fine.
  7. Downgrade to netlify-cli@^9.
  8. Browse to http://localhost:8888 (the netlify-cli dev server).
  9. Try again; observe that Fast Refresh is working fine.

Configuration

Bug is demonstrable with zero config.

Environment

System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 88.89 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.18 - /opt/homebrew/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  npmPackages:
    netlify-cli: ^10.1.0 => 10.1.0

Metadata

Metadata

Assignees

Labels

type: bugcode to address defects in shipped code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions