# @azimutlabs/rollup-plugin-external

> Rollup plugin to exclude external dependencies from bundle

Latest version **0.1.0** (published 2021-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @azimutlabs/rollup-plugin-external
pnpm add @azimutlabs/rollup-plugin-external
yarn add @azimutlabs/rollup-plugin-external
bun add @azimutlabs/rollup-plugin-external
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2021-02-26 |
| First published | 2021-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Azimut Labs |
| Maintainers | azimutlabs-owner, olehan |
| Keywords | plugin, rollup, rollup-plugin, alabs, azimutlabs |

## Links

- npm: https://www.npmjs.com/package/@azimutlabs/rollup-plugin-external
- Repository: https://github.com/azimutlabs/rollup
- Homepage: https://github.com/azimutlabs/rollup#readme
- Issues: https://github.com/azimutlabs/rollup/issues
- npm.io page: https://npm.io/package/@azimutlabs/rollup-plugin-external

## Dependencies (4)

- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^7.0.1
- [is-valid-path](https://npm.io/package/is-valid-path.md) ^0.1.1
- [lodash.concat](https://npm.io/package/lodash.concat.md) ^4.5.0
- [builtin-modules](https://npm.io/package/builtin-modules.md) ^3.2.0

## 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.1.0 (latest) — 2021-02-26
- 0.1.0-alpha.0 — 2021-02-24

## README

<h1 align="center">
  <a target="_blank" href="https://alabs.team">
    🍣
    <img
      height="22.5"
      src="https://raw.githubusercontent.com/azimutlabs/logos/master/little_logo.png"
      alt="azimutlabs logo"
    />
    /rollup-plugin-external
  </a>
</h1>

<p align="center">Rollup plugin to exclude external dependencies from bundle</p>

<p align="center">
  <a href="https://github.com/azimutlabs/rollup/actions?query=workflow%3A%22Lint+and+Test%22">
    <img
      src="https://github.com/azimutlabs/rollup/workflows/Lint%20and%20Test/badge.svg"
      alt="azimutlabs/rollup repository github workflow status"
    />
  </a>
  <a href="https://github.com/azimutlabs/rollup/blob/master/LICENSE">
    <img
      src="https://img.shields.io/github/license/azimutlabs/rollup?label=License"
      alt="azimutlabs/rollup repository license"
    />
  </a>
  <a href="https://www.npmjs.com/package/@azimutlabs/rollup-plugin-external">
    <img
      src="https://img.shields.io/npm/v/@azimutlabs/rollup-plugin-external?color=blue&logo=npm&label="
      alt="@azimutlabs/rollup-plugin-external"
    />
  </a>
</p>

## Installation
```shell
$ yarn add -D @azimutlabs/rollup-plugin-external
```

## Usage
```javascript
// rollup.config.js
import external from '@azimutlabs/rollup-plugin-external';

export default {
  input: 'index.js',
  plugins: [
    external({
      // Default options.
      useDependencies: true,
      usePeerDependencies: true,
      useBuiltins: true,
      checkForBabelMacro: false,
      packagePath: process.cwd(),
    }),
  ],
};
```

Plugin does not override rollup's [external](https://rollupjs.org/guide/en/#external) option.
Instead, it firstly looks for external, then applies plugin's core functionality
```javascript
// rollup.package.js
import external from '@azimutlabs/rollup-plugin-external';

export default {
  input: 'index.js',
  plugins: [external()],
  external: id => id.includes('fp-ts'),
};
```

## Options
| Name | Description | Type | Default |
|------|-------------|------|---------|
|`useDependencies`|Indicates whether to include `dependencies` from `package.json`|`boolean`|`true`|
|`usePeerDependencies`|Indicates whether to include `peer dependencies` from `package.json`|`boolean`|`true`|
|`useBuiltins`|Indicates whether to include **Node.js** builtin modules|`boolean`|`true`|
|`checkForBabelMacro`|Indicates whether to check `package.json` for [**Babel Macro**](https://github.com/kentcdodds/babel-plugin-macros) packages|`boolean`|`false`|
|`packagePath`|Directory or path to `package.json`. If not provided, looks for the closest `package.json` starting from current directory|`string`|`process.cwd()`|

## Acknowledgement
This plugin was inspired by [`rollup-plugin-auto-external`](https://github.com/stevenbenisek/rollup-plugin-auto-external)

## Contributing
Any PR is welcomed by our **@js-opensource** team.
Check out our [contributing](../../CONTRIBUTING.md) guidelines for more info.

## License
[![azimutlabs rollup config license](https://img.shields.io/github/license/azimutlabs/rollup?label=as%20always&color=informational)](../../LICENSE)

---
_Source: https://npm.io/package/@azimutlabs/rollup-plugin-external · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
