Closed ananaszjoe closed 1 year ago
That's weird as hell. Will def look into this this week
Can confirm, any eta?
https://github.com/feathersjs/feathers/issues/510
Using global
is not a great idea.
Sorry i didn't get around to this. On vacation for the holidays so I'm having trouble getting around to this PRs are always welcome :)
@hipstersmoothie I was suggesting that babel-polyfill clobbers global.Promise
. I don't understand why they do that if a symbol exists at that location, but it'd be an issue with babel-polyfill in that case.
In general, I would recommend to not use global
in user code. If you want bluebird, just const Promise = require("bluebird");
everywhere where you want to use it.
That being said, the actual on-disk modules that are produced by jimp are a horror to debug and I don't think a babel-polyfill should be loaded by a dependency in a NodeJS project...
Awesome findings! What would you suggest doing instead of babel polyfill to support old versions of node?
Also how are they a horror to debug? I'm interested in filing issues for this is you can provide examples.
PRs welcome ❤️
(I agree that using global like this is probably not the best idea @ananaszjoe is this the suggested way of using bluebird? I have never used it)
What would you suggest doing instead of babel polyfill to support old versions of node?
Don't support old versions. If the consumer of the library wants to use it with an older version of Node, have them include a polyfill where it makes sense for them.
Also how are they a horror to debug?
When I set a breakpoint on the require("jimp")
call and step into the module code, I find it very hard to follow. Especially if your goal is to find out where something might register a symbol on global
. But that might just be me. I just don't like debugging transpiled code. And I only got into this issue randomly. I'm not even affected by it. So I guess we can ignore my personal preference here.
:rocket: Issue was released in v0.21.0
:rocket:
Expected Behavior
Jimp should not break other modules
Current Behavior
I use Bluebird and Raven like so:
if I require Jimp in my project like so,
var Jimp = require('jimp')
It breaks Bluebird's pormisifyAll function and I get the following error:TypeError: global.Promise.promisifyAll is not a function
When I only remove
var Jimp = require('jimp')
from my poject, it runs without problem.Steps to Reproduce
Include and use Bluebird and Raven like so (app.js):
Include Jimp in the project (for me it's in a separate file for a controller):
var Jimp = require('jimp')
run
$ node app
Context
Failure Logs