Registry / web-framework / esbuild-plugin-pino

esbuild-plugin-pino

JSON →
library2.3.3jsnpmunverified

esbuild-plugin-pino is an esbuild plugin that enables bundling Pino (v7+) with applications by generating extra files required by Pino's worker-thread-based transport architecture. Current stable version is 2.3.3, released regularly with dependency updates. Unlike naive bundling attempts that break Pino's runtime, this plugin automatically produces thread-stream.js, pino-worker.js, pino-pipeline-worker.js, pino-file.js, and any custom transport bundles alongside your main output. It supports ESM and CJS, ships TypeScript types, and requires esbuild 0.25.0–0.25.8, pino >=7, plus optional pino-pretty and thread-stream as peer dependencies.

web-frameworkdatabaseauth-security
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
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin provides both ESM default export and CJS module.exports. The require pattern shown is also correct but avoids potential .default issue in mixed environments.

import esbuildPluginPino from 'esbuild-plugin-pino'

Named export available since v2.3.3. Using a different name like pinoPlugin still works but may cause confusion.

import { esbuildPluginPino } from 'esbuild-plugin-pino'

PluginOptions is a TypeScript type; use type-only import to avoid runtime inclusion.

import type { PluginOptions } from 'esbuild-plugin-pino'

CommonJS require works as plugin exports a single function. Avoid naming it 'pino' to prevent confusion with the pino logger.

const esbuildPluginPino = require('esbuild-plugin-pino')

Shows basic usage: import plugin, pass it to esbuild build with transports option, and use pino logger with that transport at runtime.

// esbuild build script with pino plugin import { build } from 'esbuild'; import esbuildPluginPino from 'esbuild-plugin-pino'; await build({ entryPoints: ['src/index.ts'], outdir: 'dist', bundle: true, plugins: [esbuildPluginPino({ transports: ['pino-pretty'] })], }); // Then in your application: import pino from 'pino'; const logger = pino({ transport: { target: 'pino-pretty', options: { colorize: true } } }); logger.info('Hello from bundled app!');
Debug
Known footguns
breakingesbuild peer dependency range is strict: esbuild >=0.25.0 <=0.25.8. Using esbuild outside this range may cause plugin failures.
gotchaExtra files (thread-stream.js, pino-worker.js, pino-pipeline-worker.js, pino-file.js) are generated in outdir. These must be included in deployment; missing them causes runtime errors.
deprecatedpino-pipeline-worker.js is no longer required after Pino v9.1.0. It may still be generated but is unnecessary.
gotchaYarn PnP users must add package extensions in .yarnrc.yml for pino, pino-pretty, and thread-stream.
breakingThe plugin output changed between v1.x and v2.x; upgrade may require adjusting deployment scripts for generated files.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
16 hits · last 30 days
gptbot
4
ahrefsbot
3
claudebot
3
chatgpt-user
2
script
1
bytedance
1
Resources