Contents of the docs
esbuild-plugin-time · Docs
Overview
esbuild plugin that logs the start and end of every build to the console and measures its duration in milliseconds.
esbuild is fast, but with several bundles or in watch mode you still want to see when a build runs and how long it
takes. esbuild-plugin-time prints two lines to the console for every build.
Quick example
import esbuild from 'esbuild';
import time from 'esbuild-plugin-time';
await esbuild.build({
entryPoints: ['./src/index.js'],
bundle: true,
outfile: './dist/index.js',
plugins: [
time('App'),
],
});Output:
Build started for App
Build ended App: 42msThe name is shown in green, the duration in yellow.
What the plugin does
- In
onStartit remembers the start time, inonEndit prints the elapsed time. - In watch mode it measures every rebuild.
- A name lets you tell several bundles apart in the output.
Status
Version 1.0.0, written in 2021. Tested with esbuild 0.28 and Node.js 22.
Related packages
The three esbuild plugins are meant as a set:
- esbuild-plugin-clear: empties the output directory before the build.
- esbuild-plugin-copy: copies files into the output directory after the build.