How to show build time with react.js using vite?

Member

by gilbert , in category: Javascript , 2 months ago

How to show build time with react.js using vite?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by deron , 2 months ago

@gilbert 

To show build time with React.js using Vite, you can use the vite-plugin-time plugin.


First, install the plugin by running the following command:

1
npm install vite-plugin-time --save-dev


Next, add the plugin to your Vite config file (usually vite.config.js):

1
2
3
4
5
import time from 'vite-plugin-time';

export default {
  plugins: [time()]
};


Now, every time you run vite build or vite dev, the build time will be displayed in the console. This can be helpful for tracking the performance of your build process.