Open Prajwalprakash3722 opened 1 year ago
How long is the startup time? Let's have some numbers before we try to shift
We don't use webpack, we use whatever react-scripts gives us oob, which is conveniently webpack.
Fresh start time (new npm install && npm start): 35.593s Normal start time (npm start): 9s Hot-reload time: 3s Fresh build time: 55s Repeated build time: 24s
Based on these numbers, it appears that the fresh start time is significantly longer than the other startup times. This may be due to the fact that a fresh start involves a lot of initialization and setup tasks.
@chrisvrose I tried to migrate the build and dev rollup to vite, these are the results
I recon this is a considerable improvement, anyhow we should look into optimising for prod build
Sorry, missed the message earlier.
There are few points to consider for discussion
Fresh start time (new npm install && npm start): 35.593s
- This is really not that important - for dev or production (Matters even less here). For dev, there's two parts -
npm install
followed bynpm start
. Less than a minute (considering our site size) - we are good. However, it takes a while to download and set dependencies, so it depends on network as well. For production, we don't even use npm install, the container ships with all the dependencies.npm start
- takes 9s as you mentioned, that is relatively okay, but it could be better.Hot-reload time: 3s
- This is relatively important. Does vite improve on this?
Fresh build time: 55s Repeated build time: 24s
- This is a pain, but I think this is a production build. Can we measure bundle sizes at the end?
There are two things that I think we should also take into consideration -
This is relatively important. Does vite improve on this?
Oh yes, it improves it to almost ~500ms
This is a pain, but I think this is a production build. Can we measure bundle sizes at the end?
Bundler Gzip Size Vite 341.33 Kib Web-Pack 324.91 kB
We might have to do lot of dynamic imports, code spiting to improve the bundle size
Maintaining - Right now, we pretend webpack is a part of react and roll with it. If we transfer to vite, it will become something we have to take care of. Do we want to be doing that?
Yea, It's a better choice where we can customise the buiid and dev options, experiment and improve a lot.
Steps to reproduce:
Run the command
npm start
to start the development server, Observe the time taken for the server to start up.FYI @chrisvrose @MayurSChittaragi