esbuild-plugin-time
raw JSON → 1.0.0 verified Mon Apr 27 auth: no javascript
A simple esbuild plugin that measures and logs the build time. Current stable version is 1.0.0. It is a lightweight, zero-configuration plugin that wraps esbuild's build process to report duration. No breaking changes known, minimal API surface. Use it to gain insight into build performance with minimal overhead.
Common errors
error Cannot find module 'esbuild-plugin-time' ↓
cause Package not installed or used without installing esbuild as a dependency.
fix
Run npm install --save-dev esbuild esbuild-plugin-time
error require() of ES Module not supported ↓
cause Using require() in a CommonJS context for an ESM-only package.
fix
Use dynamic import: const time = (await import('esbuild-plugin-time')).default; or switch to ESM.
error TypeError: time is not a function ↓
cause Importing as named export 'time' instead of default.
fix
Use import time from 'esbuild-plugin-time' (default import).
Warnings
gotcha The plugin always logs to console.log; cannot be silenced or redirected. ↓
fix No workaround. If you need silent builds, consider forking or not using this plugin.
gotcha No TypeScript definitions provided; you may encounter type errors if using strict TypeScript. ↓
fix Create your own type declaration file (e.g., declare module 'esbuild-plugin-time') or use @ts-ignore.
gotcha Plugin does not support watch mode; duration is measured only for a single build invocation. ↓
fix If using watch mode, expect the timer to reset with each rebuild but no special behavior.
Install
npm install esbuild-plugin-time yarn add esbuild-plugin-time pnpm add esbuild-plugin-time Imports
- default export (time) wrong
const time = require('esbuild-plugin-time')correctimport time from 'esbuild-plugin-time' - require (CommonJS) wrong
const time = require('esbuild-plugin-time')correctconst time = require('esbuild-plugin-time').default || require('esbuild-plugin-time') - TypeScript usage wrong
import { time } from 'esbuild-plugin-time'correctimport time from 'esbuild-plugin-time'
Quickstart
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(),
],
});