The promise of Babel and the Bluebird

By default, Babel offers a Promise polyfill. How can I make it use the Bluebird implementation or disable polyfill (I am using preset es2015).

It's easy to forget Bluebird imports and accidentally use a polyfill implementation.

+4
source share
1 answer

I assume this preset should solve the problem: babel-preset-async-to-bluebird

After installation with the usual:

$ npm install --save-dev babel-preset-async-to-bluebird

The following code using the Node API will enable this preset:

require("babel-core").transform("code", {
  presets: ["async-to-bluebird"]
});

slightly adapted from readme.md written by eknkc

+4
source

Source: https://habr.com/ru/post/1617674/


All Articles