Registry / devops / esbuild-plugin-external-package

esbuild-plugin-external-package

JSON →
library1.0.0jsnpmunverified

An esbuild plugin that automatically marks all dependencies from package.json as external during bundling. Version 1.0.0 is the initial stable release with no known release cadence. Unlike manual externals configuration, it scans dependencies, devDependencies, peerDependencies, and optionalDependencies, saving developers from maintaining a separate list. Ships TypeScript types. Lightweight with no runtime dependencies.

npm install esbuild-plugin-external-package
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-EXT
E
esbuild-plugin-external-package
devopsjavascriptv1.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.

default
✓ import externalPackage from 'esbuild-plugin-external-package'
✗ import { externalPackage } from 'esbuild-plugin-external-package'
The plugin is a default export, not a named export.
externalPackage
✓ import externalPackage from 'esbuild-plugin-external-package'
✗ const externalPackage = require('esbuild-plugin-external-package')
The package is ESM-only; CommonJS require will fail unless using dynamic import.
type definition
✓ import type { ExternalPackagePlugin } from 'esbuild-plugin-external-package'
TypeScript types are included; use import type for type-only usage.

Builds a bundle where all package.json dependencies are marked external, leaving them as imports in the output.

import esbuild from 'esbuild'; import externalPackage from 'esbuild-plugin-external-package'; await esbuild.build({ entryPoints: ['./src/index.js'], bundle: true, outfile: './dist/index.js', plugins: [externalPackage], format: 'esm', target: 'es2020', });
Debug
Known issues
gotchaPlugin uses ESBuild's analyzeMetafile? No, it only marks externals; does not modify bundle otherwise.
fix
If you need externals but also metafile analysis, combine with other plugins.
affects: 1.0.0
gotchaPlugin marks all dependencies as external, including devDependencies. This may cause runtime errors if devDependencies are needed at runtime.
fix
Update plugin configuration if available, or filter dependencies manually.
affects: 1.0.0
Errors
Common errors & fixes
Error: [plugin: external-package] Must use import to load ES Module: /path/to/esbuild-plugin-external-package
Using CommonJS require() on an ESM-only package.
fix
Use import or dynamic import() instead of require().
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
esbuild-plugin-external-package — npm install esbuild-plugin-external-package · libregistry