global.Promise=require("bluebird");
Is it suitable to replace the v8's Promise implementation?
Yes, it is.
In general - the issue tracker is not the place to ask support questions - you can use the disqus comments in the docs, stack overflow or other support channels.
Since the answer wasn't obvious from the docs - please feel free to follow up with a docs pull request.
Caveat: Note that bluebird intentionally does not support direct promise subclassing. It is extremely rare to see this used in Node or in general. If someone ever asks for this (and in almost 3 years no one ever has) it can be considered.
No subclassing
I'm having issues with this, when I put Bluebird on global.Promise it is still the old Promise in another file that is loaded later. Using babel-register and babel-polyfill to get ES6 semantics, before loading Bluebird.
@wmertens You might want to file a distinct issue with this. Sounds like a conflict between Babel's promises polyfill and Bluebird.
some of babel's transformations turn code like this:
const foo = new Promise(resolve => resolve(true));
into
const foo = new corejs.Promise(resolve => resolve(true));
in which case obviously the global.Promise = assignment will have no effect. Likely this is what is happening here.
Thanks @phpnode that makes a lot of sense. There are Babel tweaks like https://babeljs.io/docs/plugins/transform-async-to-module-method/ but that's for the async/await polyfill specifically, no override. According to https://github.com/babel/babel-loader the only way might be:
require('babel-runtime/core-js/promise').default = require('bluebird');
(I don't use Babel so I haven't tested this.)
changing global.Promise has no effect on result type of async functions, see https://github.com/petkaantonov/bluebird/issues/1404
Please, try to use npm i babel-preset-bluebird -D transformations: https://www.npmjs.com/package/babel-preset-bluebird
Hope this helps
Most helpful comment
No subclassing