Skip to content

How do I debug HMR/React Fast Refresh not working? #4577

Answered by fatso83
fatso83 asked this question in Q&A
Discussion options

You must be logged in to vote

OK, I figured this one out. It was not exactly the file I thought was the culprit, but something I uncommented at the same time. In fact, it was not a single import, but actually an export.

It turns out, that if I add any named export to App.tsx, all HMR stops working. Just adding export const foo = 12 breaks it.

I made a minimal repo to demonstrate this here: https://github.com/fatso83/break-vite-hmr-with-export
The single line needed to screw up HMR: fatso83/break-vite-hmr-with-export@e3159d5#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R7

Replies: 9 comments 29 replies

Comment options

You must be logged in to vote
1 reply
@benjamingr
Comment options

Comment options

You must be logged in to vote
3 replies
@fatso83
Comment options

@GeorgeDewar
Comment options

@fordooo
Comment options

Answer selected by fatso83
Comment options

You must be logged in to vote
2 replies
@fatso83
Comment options

@fatso83
Comment options

Comment options

You must be logged in to vote
7 replies
@jonaskuske
Comment options

@milky2028
Comment options

@fatso83
Comment options

@fatso83
Comment options

@fatso83
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@fatso83
Comment options

@baba990aini
Comment options

Comment options

You must be logged in to vote
5 replies
@thomaszdxsn
Comment options

@chenxiaochun
Comment options

@thomaszdxsn
Comment options

@chenxiaochun
Comment options

@isnifer
Comment options

Comment options

You must be logged in to vote
9 replies
@VamOSGS
Comment options

@bastianwegge
Comment options

@VamOSGS
Comment options

@bastianwegge
Comment options

@VamOSGS
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment