{"id":19049,"library":"babel-plugin-es6-promise","title":"babel-plugin-es6-promise","description":"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.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/novemberborn/babel-plugin-es6-promise","tags":["javascript","babel-plugin","promise","polyfill"],"install":[{"cmd":"npm install babel-plugin-es6-promise","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-es6-promise","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-es6-promise","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; must be installed separately to provide the actual polyfill.","package":"es6-promise","optional":false}],"imports":[{"note":"Use the short plugin name 'es6-promise' in Babel config; the full 'babel-plugin-' prefix is not needed.","wrong":"{\n  \"plugins\": [\"babel-plugin-es6-promise\"]\n}","symbol":"plugin itself (Babel config)","correct":"{\n  \"plugins\": [\"es6-promise\"]\n}"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev babel-plugin-es6-promise es6-promise\n\n// .babelrc\n{\n  \"plugins\": [\"es6-promise\"]\n}\n\n// Input file (main.js)\nconst promise = new Promise((resolve) => resolve('hello'));\npromise.then(console.log);\n\n// Run babel\nnpx babel main.js\n\n// Output (example):\nvar _Promise = typeof Promise === 'undefined'\n  ? require('es6-promise').Promise\n  : Promise;\n\nvar promise = new _Promise(function (resolve) {\n  resolve('hello');\n});\npromise.then(console.log);","lang":"javascript","description":"Setup and usage of babel-plugin-es6-promise: install, configure Babel, and see the transformation with conditional polyfill loading."},"warnings":[{"fix":"Run `npm install --save es6-promise` in addition to the plugin.","message":"Requires es6-promise as a separate installation; not bundled.","severity":"breaking","affected_versions":"all"},{"fix":"Avoid combining with other Babel plugins that rely on ES module syntax transformations.","message":"Uses CommonJS require() not ES imports; may conflict with other import/export transforms.","severity":"gotcha","affected_versions":"all"},{"fix":"Use unique variable names in your code; the plugin renames all Promise references globally.","message":"Variable name '_Promise' is generated by Babel and may conflict with user code if using a similar pattern.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider modern alternatives like @babel/plugin-transform-runtime with core-js or polyfill-service.","message":"Package is in maintenance mode; no updates since 2016, lacks support for modern JavaScript features like async/await.","severity":"deprecated","affected_versions":">=1.1.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save es6-promise`.","cause":"Missing es6-promise peer dependency.","error":"Module not found: Can't resolve 'es6-promise'"},{"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'.","cause":"Plugin not installed or incorrectly named in Babel config.","error":"Cannot find module 'babel-plugin-es6-promise'"},{"fix":"Check Babel config includes \"plugins\": [\"es6-promise\"] and run Babel on files that use Promise.","cause":"Plugin transformation not applied; likely because file does not reference Promise or Babel is not configured.","error":"ReferenceError: Promise is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}