-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from Webpack to Vite #2781
Conversation
Found a bug. If you make a new chain and press Ctrl+N, you'll get the "Are you sure?" alert twice. This bug doesn't happen on main. |
And finally, this is finished. |
Almost there. Last thing is to figure out what broke npm start... |
You're just gonna have to be ok with index.html being in the root. There's probably some combination of configs that would allow us to easily have it in another folder, but i've wasted enough of my time trying to figure out what that is to justify it. It works fine like this. |
This was incredibly difficult to pull off and took 3 separate attempts (4 if you count me almost giving up during this attempt and basically starting over)
This required a bunch of prerequisite work to remove node-only code from the renderer and fixing a bunch of electron worst-practices. Not everything is currently perfect (we still need a bunch of polyfills for certain things and the way we do IPC is still technically not best-practice) but it is still better than it was before. This was necessary because unlike webpack, there was no option with Vite to just use the node libraries in the browser. This ultimately ended up being a good thing, because supposedly this all helps security.
The big win from switching to Vite though is the improved DX. Webpack + Babel is slow, Vite(esbuild) + SWC is really fast. Vite also has Hot Module Replacement which means the app doesn't have to reload everything when you make a change to a small component. Vite also allows hot-reloading the electron main process, so now we won't spend hours trying to figure out why our main process changes aren't working only to realize we never restarted the app.
There's still a few things left to complete on this before merging, but overall I'm super happy that we were able to pull this off as it will make chaiNNer development much better.