Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default export (time)
✓ import time from 'esbuild-plugin-time'
✗ const time = require('esbuild-plugin-time')
The package exports a single function as default. Use ESM import. For CommonJS, use dynamic import or wrap with require (not official).
require (CommonJS)
✓ const time = require('esbuild-plugin-time').default || require('esbuild-plugin-time')
✗ const time = require('esbuild-plugin-time')
In CommonJS, the default export is not directly accessible; you may need to access .default or rely on the package's CJS compatibility. Use ESM when possible.
TypeScript usage
✓ import time from 'esbuild-plugin-time'
✗ import { time } from 'esbuild-plugin-time'
The package does not export named 'time', only default. TypeScript users must import the default export. No types provided; use @types/esbuild or define your own.
Shows basic setup: import esbuild and the plugin, then use time() in the plugins array to log build duration.
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(),
],
});
Errors
Common errors & fixes
Cannot find module 'esbuild-plugin-time'
Package not installed or used without installing esbuild as a dependency.
fixRun npm install --save-dev esbuild esbuild-plugin-time
require() of ES Module not supported
Using require() in a CommonJS context for an ESM-only package.
fixUse dynamic import: const time = (await import('esbuild-plugin-time')).default; or switch to ESM. TypeError: time is not a function
Importing as named export 'time' instead of default.
fixUse import time from 'esbuild-plugin-time' (default import).
Audit
Dependencies
esbuildrequiredpeer dependency: the plugin works with esbuild's build API