Registry / devops / esbuild-plugin-noexternal

esbuild-plugin-noexternal

JSON →
library0.1.6jsnpmunverified

An esbuild plugin that externalizes all npm packages except those explicitly allowed. v0.1.6, stable but minimal release cadence. The key differentiator is simplicity: it inverts esbuild's default externalization logic by marking everything external except a user-defined list, similar to Vite's `noExternal` option. Best for build scenarios like SSR or bundling where most dependencies should be excluded. Ships TypeScript types.

npm install esbuild-plugin-noexternal
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-NOE
E
esbuild-plugin-noexternal
devopsjavascriptv0.1.6
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 externalizeAllPackagesExcept from 'esbuild-plugin-noexternal'
const externalizeAllPackagesExcept = require('esbuild-plugin-noexternal')
Package is ESM-only; CommonJS require is not supported.
externalizeAllPackagesExcept (named)
import { externalizeAllPackagesExcept } from 'esbuild-plugin-noexternal'
import externalizeAllPackagesExcept from 'esbuild-plugin-noexternal'
Both default and named exports exist; the named export is an alias for the default export.
Plugin type
import type { Plugin } from 'esbuild'
import { Plugin } from 'esbuild-plugin-noexternal'
The package does not export plugin types; use esbuild's own Plugin type if needed.

Builds a bundle that includes only 'nanoid' and 'slash'; all other npm packages are treated as external.

import esbuild from 'esbuild'; import externalizeAllPackagesExcept from 'esbuild-plugin-noexternal'; await esbuild.build({ entryPoints: ['src/index.ts'], bundle: true, outfile: 'out.js', plugins: [externalizeAllPackagesExcept(['nanoid', 'slash'])], });
Debug
Known issues
gotchaPlugin uses 'onResolve' to mark packages as external; does not support custom filter or namespace.
fix
If you need more control, consider writing a custom 'onResolve' plugin or using esbuild-plugin-external-global-packages.
affects: >=0.1.0
gotchaAll external packages must be installed; the plugin does not validate package existence.
fix
Ensure all dependencies not in the listed array are installed; otherwise imports will fail at runtime.
affects: >=0.1.0
deprecatedNo known deprecations.
Errors
Common errors & fixes
Cannot find module 'esbuild-plugin-noexternal'
Package not installed.
fix
npm install -D esbuild-plugin-noexternal
The requested module 'esbuild-plugin-noexternal' does not provide an export named 'default'
Using named import instead of default import incorrectly.
fix
Use: import externalizeAllPackagesExcept from 'esbuild-plugin-noexternal'
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency; plugin is designed for use with esbuild's plugin system
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-noexternal — npm install esbuild-plugin-noexternal · libregistry