-
Some context: Node: 18.12.1 New to using vite in general, and wanted to get a rails / typescript prjoect going. Through a bad amount of trial and error, I've figured out the following in my setup:
Will render completely fine. However, as soon as I even declare a functional component, I start to receive an error
Whats even weirder is that class based components are completely fine. It feels like this is some sort of transpiling issue or something. Is there some sort of config that needs to be set in order to use modern features when using vite/rails? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @meeoh! The error from The plugin is attempting to warn you that HMR will not work in your current setup. Vite Ruby provides |
Beta Was this translation helpful? Give feedback.
-
Helped me. |
Beta Was this translation helpful? Give feedback.
Hi @meeoh!
The error from
@vitejs/plugin-react
is not clear, but the preamble refers to the code that creates the HMR registry.The plugin is attempting to warn you that HMR will not work in your current setup.
Vite Ruby provides
vite_react_refresh_tag
, which you should add to your layout when using@vitejs/plugin-react
(a good place is right aftervite_client_tag
).