# rollup-plugin-node-polyfills

> rollup-plugin-node-polyfills ===

Latest version **0.2.1** (published 2019-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-node-polyfills
pnpm add rollup-plugin-node-polyfills
yarn add rollup-plugin-node-polyfills
bun add rollup-plugin-node-polyfills
```

## 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.2.1 |
| Published | 2019-06-14 |
| First published | 2019-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 142 |
| Maintainers | manucorporat |
| Keywords | rollup-plugin |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-node-polyfills
- Repository: https://github.com/ionic-team/rollup-plugin-node-polyfills
- Homepage: https://github.com/ionic-team/rollup-plugin-node-polyfills#readme
- Issues: https://github.com/ionic-team/rollup-plugin-node-polyfills/issues
- npm.io page: https://npm.io/package/rollup-plugin-node-polyfills

## Dependencies (1)

- [rollup-plugin-inject](https://npm.io/package/rollup-plugin-inject.md) ^3.0.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.2.1 (latest) — 2019-06-14
- 0.2.0 — 2019-06-12
- 0.1.2 — 2019-06-07
- 0.1.1 — 2019-06-06
- 0.1.0 — 2019-06-06

## README

rollup-plugin-node-polyfills
===

```
npm install --save-dev rollup-plugin-node-polyfills
```

Allows the node builtins to be `require`d/`import`ed.

The following modules include ES6 specific version which allow you to do named imports in addition to the default import and should work fine if you only use this plugin.

- process*
- events
- stream*
- util*
- path
- buffer*
- querystring
- url*
- string_decoder*
- punycode
- http*†
- https*†
- os*
- assert*
- constants
- timers*
- console*‡
- vm*§
- zlib*
- tty
- domain
- dns∆
- dgram∆
- child_process∆
- cluster∆
- module∆
- net∆
- readline∆
- repl∆
- tls∆
- fs˚
- crypto˚


† the http and https modules are actually the same and don't differentiate based on protocol

‡ default export only, because it's console, seriously just use the global

§ vm does not have all corner cases and has less of them in a web worker

∆ not shimmed, just returns mock

˚ optional, add option to enable browserified shim

Crypto is not shimmed and and we just provide the commonjs one from browserify  and it will likely not work, if you really want it please pass `{crypto: true}` as an option.

Not all included modules rollup equally, streams (and by extension anything that requires it like http) are a mess of circular references that are pretty much impossible to tree-shake out, similarly url methods are actually a shortcut to a url object so those methods don't tree shake out very well, punycode, path, querystring, events, util, and process tree shake very well especially if you do named imports.

config for using this with something simple like events or querystring

```js
import nodePolyfills from 'rollup-plugin-node-polyfills';
rollup({
  entry: 'main.js',
  plugins: [
    nodePolyfills()
  ]
})
```

and now if main contains this, it should just work

```js
import EventEmitter from 'events';
import {inherits} from 'util';

// etc
```

Config for something more complicated like http

```js
import nodePolyfills from 'rollup-plugin-node-polyfills';
rollup({
  entry: 'main.js',
  plugins: [
    nodePolyfills()
  ]
})
```

License
===

MIT except ES6 ports of browserify modules which are whatever the original library was.

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