odota / web

React web interface for the OpenDota platform
https://www.opendota.com
MIT License
1.08k stars 390 forks source link

Move from CRA to Vite #3103

Closed bdbch closed 7 months ago

bdbch commented 1 year ago

THIS PR IS STILL WIP

This PR migrates the project from Create React App to Vite. Why?

https://semaphoreci.com/blog/vite

In general CRA is slower than Vite. Vite is pretty fast as it is using ESMby default skipping the whole bundling process for es modules.

From my tests everything looked okay. I guess secrets would need to be updates on the hosting part (as instead of using REACT_APP_* for env vars Vite is falling back to VITE_)

From my feeling Vite feels way faster and snappier on building & starting up the project, specially after the app was cached.

Important One thing that didn't work anymore was the heatmap.js package as it doesn't seem to support Vite. Looking at the activity of the package (https://github.com/pa7/heatmap.js) it seems to be quite dead.

To fix this issue for now I built a very basic heatmap with canvas on my own. It's not as beautiful as heatmap.js heatmaps because of the missing color grading between points - but this could be built afterwards.

Otherwise the PR currently does not load the page since something is not working with Recharts. Looking at this tomorrow.

howardchung commented 7 months ago

I've done a little research into converting CRA projects and it seems like Vite is an easier drop-in replacement for CRA, so if the Next.js effort is stalled it seems we could get some dev wins out of figuring out the blockers here