Open juanca opened 6 years ago
hypernova used bluebird, but doesn’t shim anything; promisifyAll is a bluebird method. Perhaps you have code that is relying on bluebird being the global Promise?
I looked into it a bit more.
I have been able to isolate the side effects with the following code:
var Promise = require('bluebird');
console.log(Promise.promisifyAll);
const hypernova = require('hypernova/server');
console.log(Promise.promisifyAll);
which outputs the following:
yarn run v1.6.0
$ node script/hypernova.js
[Function]
undefined
I'm going to dig into hypernova/server
now -- though at a quick glance I can't seem to find any reference to bluebird.
For the sake of more information:
yarn why v1.6.0
[1/4] 🤔 Why do we have the module "bluebird"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "bluebird@3.5.1"
info Reasons this module exists
- "karma" depends on it
- Hoisted from "karma#bluebird"
- Hoisted from "html-webpack-plugin#bluebird"
- Hoisted from "svg-sprite-loader#bluebird"
- Hoisted from "hypernova#bluebird"
- Hoisted from "svg-sprite-loader#svg-baker#bluebird"
- Hoisted from "webpack-bundle-analyzer#bfj-node4#bluebird"
- Hoisted from "karma#log4js#amqplib#bluebird"
- Hoisted from "react-styleguidist#copy-webpack-plugin#cacache#bluebird"
info Disk size without dependencies: "192MB"
info Disk size with unique dependencies: "192MB"
info Disk size with transitive dependencies: "192MB"
info Number of shared dependencies: 0
Done in 1.28s.
It seems that node_modules/hypernova/lib/environment.js
is modifying the exported module from bluebird.
What's the intention of that file?
I'll open a PR in case we want some changes.
ah, it's to ensure that the global promise lacks Bluebird-specific methods.
Environment:
I'm starting to set up hypernova in a Rails + Webpack repository.
By importing the hypernova server module, it seems my globals are polluted.
The only difference in my script is the following line:
which produces the following error trace:
While the error is not in the hypernova source, it is being caused by a hypernova module -- since it works without processing the module.
I was wondering whether this is true, whether this is fixable, whether this is intended, etc. I would be happy to make a PR if it is an acceptable improvement: removing dependencies on the global Promise object.