You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the pattern is not generated by SWC for class components, as fast refresh does not preserve their state (see swc-project/swc#4431 (comment)).
So a module with no exported functional component is not handled by HMR.
(Note: I will provide a PR.)
The text was updated successfully, but these errors were encountered:
n9
pushed a commit
to n9/vite-plugin-react-swc
that referenced
this issue
Apr 26, 2024
When it works
If a class component is exported from a module that also exports a functional component.
Sample:
When it does not work
If a class component is exported from a module that exports no functional component.
Sample:
Why it does not work
The refresh runtime is only included
vite-plugin-react-swc/src/index.ts
Lines 161 to 168 in 21eef9e
if the code of module matches
vite-plugin-react-swc/src/index.ts
Line 29 in 21eef9e
However, the pattern is not generated by SWC for class components, as fast refresh does not preserve their state (see swc-project/swc#4431 (comment)).
So a module with no exported functional component is not handled by HMR.
(Note: I will provide a PR.)
The text was updated successfully, but these errors were encountered: