Registry / devops / babel-plugin-es6-promise

babel-plugin-es6-promise

JSON →
library1.1.1jsnpmunverified

Babel plugin that rewrites Promise references to the es6-promise polyfill only when necessary (i.e., when the native Promise is not available). Version 1.1.1 is the latest stable release. Key differentiator: it conditionally loads the polyfill based on environment, reducing bundle size for modern platforms. Requires es6-promise as a separate dependency (peer dependency). Tested with Node 0.10+, but primarily useful for legacy browser support and older Node versions.

npm install babel-plugin-es6-promise
INSTALL
IMPORT
SIG · BABEL-PLUGIN-ES6-P
B
babel-plugin-es6-promise
devopsjavascriptv1.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin itself (Babel config)
{ "plugins": ["es6-promise"] }
{ "plugins": ["babel-plugin-es6-promise"] }
Use the short plugin name 'es6-promise' in Babel config; the full 'babel-plugin-' prefix is not needed.

Setup and usage of babel-plugin-es6-promise: install, configure Babel, and see the transformation with conditional polyfill loading.

// Install dependencies npm install --save-dev babel-plugin-es6-promise es6-promise // .babelrc { "plugins": ["es6-promise"] } // Input file (main.js) const promise = new Promise((resolve) => resolve('hello')); promise.then(console.log); // Run babel npx babel main.js // Output (example): var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; var promise = new _Promise(function (resolve) { resolve('hello'); }); promise.then(console.log);
Debug
Known issues
breakingRequires es6-promise as a separate installation; not bundled.
fix
Run `npm install --save es6-promise` in addition to the plugin.
affects: all
gotchaUses CommonJS require() not ES imports; may conflict with other import/export transforms.
fix
Avoid combining with other Babel plugins that rely on ES module syntax transformations.
affects: all
gotchaVariable name '_Promise' is generated by Babel and may conflict with user code if using a similar pattern.
fix
Use unique variable names in your code; the plugin renames all Promise references globally.
affects: all
deprecatedPackage is in maintenance mode; no updates since 2016, lacks support for modern JavaScript features like async/await.
fix
Consider modern alternatives like @babel/plugin-transform-runtime with core-js or polyfill-service.
affects: >=1.1.1
Errors
Common errors & fixes
Module not found: Can't resolve 'es6-promise'
Missing es6-promise peer dependency.
fix
Run `npm install --save es6-promise`.
Cannot find module 'babel-plugin-es6-promise'
Plugin not installed or incorrectly named in Babel config.
fix
Ensure plugin is installed: `npm install --save-dev babel-plugin-es6-promise`. Use short name 'es6-promise' in config, not the full 'babel-plugin-es6-promise'.
ReferenceError: Promise is not defined
Plugin transformation not applied; likely because file does not reference Promise or Babel is not configured.
fix
Check Babel config includes "plugins": ["es6-promise"] and run Babel on files that use Promise.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
es6-promiserequiredPeer dependency; must be installed separately to provide the actual polyfill.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
2
Resources
babel-plugin-es6-promise — npm install babel-plugin-es6-promise · libregistry