# babel-plugin-es6-promise-esm

> Babel plugin that rewrites Promise references to es6-promise, support ESM for Rollup

Latest version **1.1.1** (published 2019-01-02) · ISC license · 0 weekly downloads

## Install

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

## 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 | 2019-01-02 |
| First published | 2019-01-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daybrush |
| Maintainers | younkue |
| Keywords | babel-plugin, promise, polyfill |

## Links

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

## 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) — 2019-01-02

## README

# babel-plugin-es6-promise-esm

Babel plugin that rewrites Promise references to [`es6-promise`], but only if
necessary. Support ES Module, Rollup.


Forked from https://github.com/novemberborn/babel-plugin-es6-promise.


## Installation

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

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

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

**[`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
import _ESPromise from "es6-promise";

var _Promise = typeof Promise === 'undefined'
  ? _ESPromise.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-esm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
