esbuild-plugin-node-externals
ESBuild plugin for node externals handing.
Usage
npm install esbuild-plugin-node-externals --save-dev
pnpm install esbuild-plugin-node-externals --save-dev
yarn add esbuild-plugin-node-externals --save-dev
import { build } from 'esbuild';
import { nodeExternals } from 'esbuild-plugin-node-externals';
(async () => {
const res = await build({
entryPoints: ['.src/main.ts'],
bundle: true,
outfile: './dist/main.js',
plugins: [
nodeExternals({
packagePaths: 'package.json',
include: ['SOME_PKG_YOU_WANT_TO_INCLUDE_AT_BUNDLE'],
}),
],
});
})();
Configurations
export interface NodeExternalsOptions {
packagePaths: string | string[];
withDeps: boolean;
withDevDeps: boolean;
withPeerDeps: boolean;
withOptDeps: boolean;
include: string[];
}