# unplugin-externalize-deps

> externalize dependencies from production build

Latest version **0.0.10** (published 2023-06-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install unplugin-externalize-deps
pnpm add unplugin-externalize-deps
yarn add unplugin-externalize-deps
bun add unplugin-externalize-deps
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2023-06-01 |
| First published | 2023-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 1 |
| Unpacked size | 17.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 3 |
| Author | YuTengjing |
| Maintainers | yutengjing |
| Keywords | unplugin, rollup, vite, external |

## Links

- npm: https://www.npmjs.com/package/unplugin-externalize-deps
- Repository: https://github.com/tjx666/unplugin-externalize-deps
- Homepage: https://github.com/tjx666/unplugin-externalize-deps#readme
- Issues: https://github.com/tjx666/unplugin-externalize-deps/issues
- npm.io page: https://npm.io/package/unplugin-externalize-deps

## Dependencies (1)

- [unplugin](https://npm.io/package/unplugin.md) ^1.3.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.10 (latest) — 2023-06-01
- 0.0.9 — 2023-02-22
- 0.0.8 — 2023-02-21
- 0.0.7 — 2023-02-21
- 0.0.6 — 2023-02-19
- 0.0.5 — 2023-02-19
- 0.0.4 — 2023-02-18
- 0.0.3 — 2023-02-18
- 0.0.2 — 2023-02-18

## README

# unplugin-externalize-deps

[![NPM version](https://img.shields.io/npm/v/unplugin-externalize-deps?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-externalize-deps) [![Test](https://github.com/tjx666/unplugin-externalize-deps/actions/workflows/test.yml/badge.svg)](https://github.com/tjx666/unplugin-externalize-deps/actions/workflows/test.yml)

externalize dependencies from production build

## 📦 Installation

```shell
# npm
npm i unplugin-externalize-deps

# pnpm
pnpm i unplugin-externalize-deps
```

<details>
<summary>Vite</summary><br>

```typescript
// vite.config.ts
import UnpluginExternalizeDeps from 'unplugin-externalize-deps/vite';

export default defineConfig({
  plugins: [UnpluginExternalizeDeps()],
});
```

<br></details>

<details>
<summary>Rollup</summary><br>

```typescript
// rollup.config.js
import UnpluginExternalizeDeps from 'unplugin-externalize-deps/rollup';

export default {
  plugins: [UnpluginExternalizeDeps()],
};
```

<br></details>

## ⚙️ Options

```typescript
export interface Options {
  /** any first level field in package.json */
  depTypes?: {
    /** @default true */
    dependencies: boolean;
    /** @default false */
    devDependencies: boolean;
    /** @default true */
    optionalDependencies: boolean;
    /** @default true */
    peerDependencies: boolean;
    [key: string]: boolean;
  };
  /**
   * whether externalize node builtin modules like: fs, path
   *
   * Note: this will also externalize node builtin modules with `node:` protocol, like: node:fs, node:path
   *
   * @default false
   */
  nodeBuiltins?: boolean;
  /**
   * the path(s) to your package.json, or similar json config file, for example: importmap config
   *
   * @default path.resolve(process.cwd(), 'package.json')
   */
  packagePath?: string | string[];
  /**
   * specify a list of deps which must bundled, a dependency will not excluded if matched
   *
   * @example ['axios', /lodash(-es)?/]
   * @default []
   */
  bundleDeps?: Array<string | RegExp>;
}
```

## ❤️ Thanks

- [unplugin-starter](https://github.com/sxzz/unplugin-starter)
- [vite-plugin-externalize-deps](https://github.com/voracious/vite-plugin-externalize-deps)
- [rollup-plugin-node-externals](https://github.com/Septh/rollup-plugin-node-externals)

---
_Source: https://npm.io/package/unplugin-externalize-deps · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
