Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin-react-refresh does not work #4142

Closed
6 tasks done
wyhaya opened this issue Jul 6, 2021 · 5 comments
Closed
6 tasks done

plugin-react-refresh does not work #4142

wyhaya opened this issue Jul 6, 2021 · 5 comments

Comments

@wyhaya
Copy link

wyhaya commented Jul 6, 2021

Describe the bug

I found when using plugin-react-refresh that I had to add an unrelated component for the hot update to work, see the video

Untitled.mov

Reproduction

vite-test.zip

System Info

System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
    Memory: 4.82 GB / 16.00 GB
    Shell: 3.3.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.4.1 - /opt/homebrew/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 7.18.1 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Safari: 14.1.1

Used Package Manager

yarn

Logs

No response

Validations

@adamlindqvist
Copy link

adamlindqvist commented Jul 6, 2021

Maybe not much of help but just want to add that I'm experiencing similar issues on my end after updating from 1.3.8 to 1.4.1. However I have problem isolating the problem in a minimal repo.

My issue is that it performs a hard reload every time I edit a file that's within a sub-folder to src/ e.g. src/components/Button.tsx or src/pages/StartPage.tsx

@y1d7ng
Copy link
Contributor

y1d7ng commented Jul 23, 2021

Don't use unnamed component.
try

const App = () => {
  return <div>123</div>
}

export default App

@lxsmnsyc
Copy link

@OneNail I have a similar problem and I tried both the App as variable and as a default function. There's no React Refresh script injected on each of the components.

@hyf0
Copy link
Contributor

hyf0 commented Aug 14, 2021

It's not a bug of vite. see #4298 (comment)

@wyhaya wyhaya closed this as completed Aug 14, 2021
@lxsmnsyc
Copy link

lxsmnsyc commented Aug 14, 2021

It's not a bug of vite. see #4298 (comment)

would it be better if I can reproduce the bug with named components?

Edit:

nvm, looks like it got fixed between 2.3.7 and 2.4.4

@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants