{"id":25045,"library":"bun-plugin-print-imports","title":"bun-plugin-print-imports","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","bun-plugin","esbuild-plugin"],"install":[{"cmd":"npm install bun-plugin-print-imports","lang":"bash","label":"npm"},{"cmd":"yarn add bun-plugin-print-imports","lang":"bash","label":"yarn"},{"cmd":"pnpm add bun-plugin-print-imports","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; requires Bun >=1.0 or Node >=16 with esbuild.","wrong":"const plugin = require('bun-plugin-print-imports')","symbol":"plugin","correct":"import { plugin } from 'bun-plugin-print-imports'"},{"note":"Default export is the same as named plugin; use either.","wrong":"import { defaultPlugin } from 'bun-plugin-print-imports'","symbol":"defaultPlugin","correct":"import defaultPlugin from 'bun-plugin-print-imports'"},{"note":"Options is a type, not a runtime value; use import type.","wrong":"import { Options } from 'bun-plugin-print-imports'","symbol":"type Options","correct":"import type { Options } from 'bun-plugin-print-imports'"},{"note":"CJS require still works via bundler shim, but ESM is preferred.","wrong":"","symbol":"plugin (CommonJS)","correct":"const { plugin } = require('bun-plugin-print-imports')"}],"quickstart":{"code":"import { plugin } from 'bun-plugin-print-imports';\n\nawait Bun.build({\n  entrypoints: ['./src/index.ts'],\n  outdir: './dist',\n  plugins: [plugin()],\n});\n\n// Or with esbuild:\n// import * as esbuild from 'esbuild';\n// await esbuild.build({\n//   entryPoints: ['./src/index.ts'],\n//   outdir: './dist',\n//   plugins: [plugin()],\n// });\n","lang":"typescript","description":"Shows how to register the plugin with Bun or esbuild to print resolved imports during build."},"warnings":[{"fix":"Switch to ESM import syntax; if using CJS, stick with 1.x or use a bundler that can handle ESM.","message":"Version 2.x requires ESM; CJS require no longer works without bundler.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use plugin({ quiet: true }) to suppress logs, or redirect stdout.","message":"Plugin logs to stdout; may interfere with tools that parse stdout.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace filter with include/exclude arrays of glob patterns.","message":"The 'filter' option was removed in 2.0.0; use 'include' and 'exclude' instead.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure dynamic imports use string literals for Bun to resolve.","message":"Only prints imports that Bun resolves; dynamic imports with variables may not appear.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update to Node 18+ or Bun 1.0+.","message":"Plugin no longer supports Node <18 or Bun <1.0.0.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `bun add bun-plugin-print-imports` or `npm install bun-plugin-print-imports`.","cause":"Package not installed or using wrong import path.","error":"Cannot find module 'bun-plugin-print-imports'"},{"fix":"Use `import { plugin } from 'bun-plugin-print-imports'` or `import defaultPlugin from 'bun-plugin-print-imports'`.","cause":"Using import incorrectly (e.g., using default import when expecting named).","error":"Plugin must be a function or object"},{"fix":"Ensure you call plugin() and pass options if needed; check import syntax.","cause":"Using plugin() without instantiation or incorrect import.","error":"TypeError: plugin is not a function"},{"fix":"Install esbuild if using esbuild, ensure Bun is up to date.","cause":"Bundler cannot resolve the plugin; often due to missing peer dependencies or misconfigured paths.","error":"Uncaught Error: Cannot find module '.'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}