Shift3 / boilerplate-client-react

The Bitwise standard starting point for new React web projects.
7 stars 10 forks source link

Switch to Vite #704

Closed DropsOfSerenity closed 1 year ago

DropsOfSerenity commented 1 year ago

This switches to vite from create-react-app. It provides a much faster development experience as it's bundling is faster. create-react-app is also going through an identity crisis right now and it's future is uncertain. See here and here

Vite's benefit is build speed. Building our react boilerplate is quite slow unless you using a modern mac. Especially initial build. Vite is much faster due to it's underlying tech. Vite will also produce smaller production builds as rollup is generally a better bundler than webpack.

create-react-app is not just for generating a react application. It also serves as a configured webpack application bundler for running the application in development and building production builds.

A couple benchmarks on my m2 mac:

Production build time

Using yarn build

Dev server cold startup time

Removing any cache in node_modules/.cache and then yarn start

Removal of tests

I've also removed our tests in this branch as I think they've gone on too long without providing value and we would need to invest time to get them working with vite, so I think it's best to get rid of them at the moment.

DropsOfSerenity commented 1 year ago

I got the following error when I tried to click on the Notification button when there were unread notifications:

Nice find! I didn't test notifications so let me go fix that.