New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rollup-plugin-pino-bundle

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-pino-bundle

Rollup plugin for bundling PinoJS logger with transports

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Rollup/Vite Pino Plugin Documentation

Overview

This plugin provides seamless bundling of Pino logger and its transports for Rollup and Vite projects. It handles the special requirements of Pino's worker threads and file transports, making them work properly in bundled applications.

Installation

npm install -D rollup-plugin-pino-bundle

Usage

Basic Configuration (Rollup)

import { rollup } from 'rollup';
import pinoBundle from 'rollup-plugin-pino-bundle';

const bundle = await rollup({
    input: 'src/main.js',
    plugins: [
        pinoBundle({
            transports: ['pino-pretty'], // optional transports to include
            pinoDir: 'custom-pino', // optional custom directory
        }),
    ],
});

Basic Configuration (Vite)

import { defineConfig } from 'vite';
import pinoBundle from 'rollup-plugin-pino-bundle';

export default defineConfig({
    plugins: [
        pinoBundle({
            transports: ['pino-pretty'], // optional transports to include
            transportsDir: 'custom-transports', // optional custom transports directory
        }),
    ],
});

Options

transports

Type: string[]
Default: []

An array of pino transport module names to bundle with your application.

Example:

pinoBundle({
    transports: ['pino-pretty', 'pino-loki'],
});

pinoDir

Type: string
Default: 'pino'

Set custom directory for pino files. This is the root directory where all pino-related files will be placed.

Example:

pinoBundle({
    pinoDir: 'custom-pino',
});

transportsDir

Type: string
Default: ${pinoDir}/transports

Set custom directory for all transports. By default, it will be a subdirectory of the pinoDir.

Example:

pinoBundle({
    transportsDir: 'my-transports', // will be relative to output directory
});

File Structure

The plugin creates the following directory structure in your output folder:

/pino
  /pino.js                # Main pino bundle
  /transports
    /pino-file.js         # File transport worker
    /pino-worker.js       # Worker implementation
    /thread-stream-worker.js # Thread stream worker
    /[transport-name].js   # Any additional transports you specify

Caching

The plugin implements caching to improve build performance

TypeScript Support

The package includes TypeScript type definitions out of the box.

Limitations

  • Currently has limited Vite dev server support (planned for future versions)

Troubleshooting

Problem: Transports not working in production build
Solution: Make sure to include all required transports in the transports option

Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.

License

MIT

Keywords

vite-plugin

FAQs

Package last updated on 07 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts