I would like to use bluebird-q (https://github.com/petkaantonov/bluebird-q) as shim for Q in browser JS application. This is not possible out of the box as the bluebird-q library code starts with 2 NodeJS style requires:
var Promise = require("bluebird/js/main/promise")(); var scheduler = require("bluebird/js/main/schedule");
These 2 requires cannot be replaced by require of whole library (https://github.com/petkaantonov/bluebird/tree/v2.10.2#for-library-authors):
var Promise = require("bluebird");
Browserify solves the problem, but this solution is not convenient enough in my opinion: it requires build step, makes the code less readable, some static code scanners do not work as expected with browserified code and most important bluebird and bluebird-q cannot be referenced as separate script files.
Two questions about this topic:
1) What is the reason whole bluebird library cannot be included into bluebird-q as is?
2) Is there more elegant solution to use bluebird-q in browser without browserify?
P.S.: I know that bluebird itself is built for browsers using browserify: this build is properly tested. There is no official browserify build of bluebird-q.