vitejs / vite-plugin-react-swc

Speed up your Vite dev server with SWC
MIT License
774 stars 49 forks source link

feat: support HMR for class components #203

Closed ArnaudBarre closed 1 month ago

ArnaudBarre commented 1 month ago

Fixes #136 Fixes #199 Closes #200

I merged ideas from @n9 in #200 and @marlo22 in fix-react-refresh-plugin

I will port the fix to the Babel plugin once merged to fix oldest issue in the React plugins!

ArnaudBarre commented 1 month ago

Yes exactly! But he support is more limited, the component will restart from scratch everytime. Because of that the react refresh transformation don't output special code and the current condition was not working for files with only class components. Because I stopped worked with class components since 2019 I didn't took time to test it 😬