Registry / devops / bun-plugin-print-imports

bun-plugin-print-imports

JSON →
library2.0.0jsnpmunverified

Bun and esbuild plugin that prints resolved import paths during bundling. Current version 2.0.0, released occasionally. Useful for debugging dependency resolution or auditing bundle contents. Differs from other logging plugins by supporting both Bun and esbuild with same API. Minimal configuration: just register and log. Works with both ESM and CJS outputs.

npm install bun-plugin-print-imports
INSTALL
IMPORT
SIG · BUN-PLUGIN-PRINT-I
B
bun-plugin-print-imports
devopsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

plugin
import { plugin } from 'bun-plugin-print-imports'
const plugin = require('bun-plugin-print-imports')
ESM-only; requires Bun >=1.0 or Node >=16 with esbuild.
defaultPlugin
import defaultPlugin from 'bun-plugin-print-imports'
import { defaultPlugin } from 'bun-plugin-print-imports'
Default export is the same as named plugin; use either.
type Options
import type { Options } from 'bun-plugin-print-imports'
import { Options } from 'bun-plugin-print-imports'
Options is a type, not a runtime value; use import type.
plugin (CommonJS)
const { plugin } = require('bun-plugin-print-imports')
CJS require still works via bundler shim, but ESM is preferred.

Shows how to register the plugin with Bun or esbuild to print resolved imports during build.

import { plugin } from 'bun-plugin-print-imports'; await Bun.build({ entrypoints: ['./src/index.ts'], outdir: './dist', plugins: [plugin()], }); // Or with esbuild: // import * as esbuild from 'esbuild'; // await esbuild.build({ // entryPoints: ['./src/index.ts'], // outdir: './dist', // plugins: [plugin()], // });
Debug
Known issues
breakingVersion 2.x requires ESM; CJS require no longer works without bundler.
fix
Switch to ESM import syntax; if using CJS, stick with 1.x or use a bundler that can handle ESM.
affects: >=2.0.0
gotchaPlugin logs to stdout; may interfere with tools that parse stdout.
fix
Use plugin({ quiet: true }) to suppress logs, or redirect stdout.
affects: >=1.0.0
deprecatedThe 'filter' option was removed in 2.0.0; use 'include' and 'exclude' instead.
fix
Replace filter with include/exclude arrays of glob patterns.
affects: >=2.0.0
gotchaOnly prints imports that Bun resolves; dynamic imports with variables may not appear.
fix
Ensure dynamic imports use string literals for Bun to resolve.
affects: >=1.0.0
breakingPlugin no longer supports Node <18 or Bun <1.0.0.
fix
Update to Node 18+ or Bun 1.0+.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'bun-plugin-print-imports'
Package not installed or using wrong import path.
fix
Run `bun add bun-plugin-print-imports` or `npm install bun-plugin-print-imports`.
Plugin must be a function or object
Using import incorrectly (e.g., using default import when expecting named).
fix
Use `import { plugin } from 'bun-plugin-print-imports'` or `import defaultPlugin from 'bun-plugin-print-imports'`.
TypeError: plugin is not a function
Using plugin() without instantiation or incorrect import.
fix
Ensure you call plugin() and pass options if needed; check import syntax.
Uncaught Error: Cannot find module '.'
Bundler cannot resolve the plugin; often due to missing peer dependencies or misconfigured paths.
fix
Install esbuild if using esbuild, ensure Bun is up to date.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bun-plugin-print-imports — npm install bun-plugin-print-imports · libregistry