UNPKG

esbuild-plugin-node-externals

Version:
41 lines 2.94 kB
{ "name": "esbuild-plugin-node-externals", "version": "1.0.1", "description": "ESBuild plugin for node externals.", "keywords": [ "ESBuild", "plugin" ], "homepage": "https://github.com/LinbuduLab/esbuild-plugins/tree/master/packages/esbuild-plugin-node-externals#readme", "changelog": "https://github.com/LinbuduLab/esbuild-plugins/blob/main/packages/esbuild-plugin-node-externals/CHANGELOG.md", "bugs": { "url": "https://github.com/LinbuduLab/esbuild-plugins/issues" }, "repository": { "type": "git", "url": "git+https://github.com/LinbuduLab/esbuild-plugins.git" }, "license": "MIT", "author": "Linbudu <linbudu599@gmail.com> (https://github.com/linbudu599)", "main": "dist/index.js", "typings": "dist/index.d.ts", "exports": { ".": { "require": "./dist/index.js", "import": "./dist/index.mjs", "types": "./dist/index.d.ts" } }, "dependencies": { "find-up": "5.0.0", "jsonfile": "^6.1.0" }, "peerDependencies": { "esbuild": ">= 0.14.0" }, "scripts": { "dev": "tsup src/index.ts --watch --dts --format esm", "build": "rm -rf dist && tsup src/index.ts --config ../../tsup.config.ts" }, "readme": "# esbuild-plugin-node-externals\n\nESBuild plugin for node externals handing.\n\n- [Author](https://github.com/linbudu599)\n- [GitHub Repo](https://github.com/LinbuduLab/esbuild-plugins/tree/master/packages/esbuild-plugin-node-externals#readme)\n- [Changelog](https://github.com/LinbuduLab/esbuild-plugins/blob/main/packages/esbuild-plugin-node-externals/CHANGELOG.md)\n\n## Usage\n\n```bash\nnpm install esbuild-plugin-node-externals --save-dev\npnpm install esbuild-plugin-node-externals --save-dev\nyarn add esbuild-plugin-node-externals --save-dev\n```\n\n```typescript\nimport { build } from 'esbuild';\nimport { nodeExternals } from 'esbuild-plugin-node-externals';\n\n(async () => {\n const res = await build({\n entryPoints: ['.src/main.ts'],\n bundle: true,\n outfile: './dist/main.js',\n plugins: [\n nodeExternals({\n packagePaths: 'package.json',\n include: ['SOME_PKG_YOU_WANT_TO_INCLUDE_AT_BUNDLE'],\n }),\n ],\n });\n})();\n```\n\n## Configurations\n\n```typescript\nexport interface NodeExternalsOptions {\n /**\n * list of package.json paths to read from\n * if not specified, will read from cwd\n */\n packagePaths: string | string[];\n\n /**\n * mark all dependencies as external\n * @default true\n */\n withDeps: boolean;\n\n /**\n * mark all devDependencies as external\n * @default true\n */\n withDevDeps: boolean;\n\n /**\n * mark all peerDependencies as external\n * @default true\n */\n withPeerDeps: boolean;\n\n /**\n * mark all optionalDependencies as external\n * @default true\n */\n withOptDeps: boolean;\n\n /**\n * list of packages to exclude from externalization\n */\n include: string[];\n}\n```\n" }