# babel-plugin-es6-promise

> Babel plugin that rewrites Promise references to es6-promise, but only if necessary

Latest version **1.1.1** (published 2017-02-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-es6-promise
pnpm add babel-plugin-es6-promise
yarn add babel-plugin-es6-promise
bun add babel-plugin-es6-promise
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-02-03 |
| First published | 2016-04-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Mark Wubben |
| Maintainers | novemberborn |
| Keywords | babel-plugin, promise, polyfill |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-es6-promise
- Repository: https://github.com/novemberborn/babel-plugin-es6-promise
- Homepage: https://github.com/novemberborn/babel-plugin-es6-promise#readme
- Issues: https://github.com/novemberborn/babel-plugin-es6-promise/issues
- npm.io page: https://npm.io/package/babel-plugin-es6-promise

## Dependencies (2)

- [babel-types](https://npm.io/package/babel-types.md) ^6.7.2
- [babel-template](https://npm.io/package/babel-template.md) ^6.7.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2017-02-03
- 1.1.0 — 2017-01-13
- 1.0.0 — 2016-04-04

## README

# babel-plugin-es6-promise

Babel plugin that rewrites Promise references to [`es6-promise`], but only if
necessary. Tested with Node.js 0.10 and above.

## Installation

```console
$ npm install --save-dev babel-plugin-es6-promise
```

Then add `es6-promise` to your Babel config, like:

```json
{
  "plugins": ["es6-promise"]
}
```

**[`es6-promise`] must be installed separately.**

## Behavior

This plugin rewrites files that reference the `Promise` built-in. It inserts the
following code at the top of each file:

```js
var _Promise = typeof Promise === 'undefined'
  ? require('es6-promise').Promise
  : Promise
```

This means [`es6-promise`] is only loaded when there is no `Promise` built-in
available. Each `Promise` reference is rewritten to `_Promise`.

Note that `require()` is used rather than a ES2015 module import. This may make
it difficult to do further import transforms.

Also note that the `_Promise` variable name in this example is determined by
Babel and may differ depending on your code.

[`es6-promise`]: https://github.com/stefanpenner/es6-promise

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