Re:Migrating from Create React App to Vite
by auggierose on Thursday October 17, 2024 @06:56AM
(#41868356)
What I mean by "live reloading" is that when you for example save a TypeScript file, esbuild does an incremental build and your webpage can check for that and reload. There is no state maintained. I think maintaining state would be a very difficult problem to solve correctly. Actually, I think that is impossible, and invites all sorts of heisenbugs, working only for simple cases.
Re:Migrating from Create React App to Vite
by lyxell on Thursday October 17, 2024 @08:28AM
(#41869019)
I’ve used both standalone esbuild as well as Vite for hundreds of hours and HMR works flawlessly in React using Vite, it’s the only reason I use Vite instead of just using esbuild directly. I suggest you to try it out.
Re:Migrating from Create React App to Vite
by ativzzz on Thursday October 17, 2024 @10:17AM
(#41869912)
I've been working with web apps for a long time and have always turned live reloading off whenever I can.
My code editor always auto saves changes so i just alt tab to browser and refresh to see changes
With live reload, often what happens, especially as projects get larger, is the watcher takes longer to trigger so the live reload is slower than just alt-tabbing, and it sometimes goes off on its own, probably due to multiple quick file changes, which is really annoying
I've never enjoyed this feature
Re:Migrating from Create React App to Vite
by ddoolin on Thursday October 17, 2024 @04:53PM
(#41873685)
It must not be that difficult as I use it every day in my Vite project. To be clear I am no Vite evangelist, but it does maintain existing state when it live reloads modules, it doesn't just refresh the page.
My guess is that Vite relies on underlying tools as much as possible and only ejects when they need to. This is also why they are writing their own version of esbuild/rollup so that more of the dev pipeline can be controlled by Vite.