-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RP2.0, in browser - Error when importing request-promise as an ES6 module #91
Comments
Hi @bobbysciacchitano this feature was not removed but if you don't call I am using such a mechanism in Webpack and it looks like this: {
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
]
} I hope something similar is available for Browserify as well. Otherwise you would need to wait for request-promise@3 where If you find a solution for Browserify please post it here. Thanks! |
@analog-nico Isn't a patch possible just to fix this? It's been a real pain have to deal with that and the webpack solution seems too hacky. |
Sorry, @schweller it is not possible unless we drop the CLS support altogether. You have to either wait for the next version or declare |
Hey @analog-nico, sorry to disturb once again about this matter, but I want to propose a patch solution before the next major release:
var request = require('./rp')
/* istanbul ignore next */ // Function covered but not seen by Instanbul.
request.bindCLS = function RP$bindCLS(ns) {
require('cls-bluebird')(ns);
};
module.exports = request;
//ES6 modules
import rp from 'request-promise/lib/experimental'
//Using require
var rp = require('request-promise/lib/experimental')
//Without experimental feature
import rp from 'request-promise' I already tested this solution locally and it works fine, but I'm forking the project so I can make a PR later today or tomorrow. Let me know if you have any concerns. |
Hi @schweller I prefer not to bump the main version yet again to not irritate the users regarding breaking changes. I googled a bit more and found out that you could use the {
"browser": {
"cls-bluebird": false
}
} But here is my offer: I will cut out enough time to work on the next version soon and you could help with officially supporting Browserify. I could use a helping hand! |
Hi thanks for the updates: For the benefit of others using Browserify the Alternatively:
|
Thanks for the info @bobbysciacchitano ! I'll keep this issue open until even |
Just ran into this issue as well using Webpack, pasting my error and solutions for those who follow in my google steps:
Fix is adding |
Hi all, I'm using Browserify with npm scripts so My solution was to use Sharing this suggestion as a follow up since ignoring all missing modules might result in modules not loaded in case of a silly error (typo or some other weird thing) and would end up ignored AFAIK. This extra ignored errors aren't a catastrophe for a temporary solution, but it might be safer (and easier to debug) this way. It won't break other public modules apart from this short list. Thanks! |
Thanks for the info @fdoxyz ! |
For those using browserify: {
ignores: ['cls-bluebird'],
}, -- Very unfortunately you have to manually include this in each host app though, so it would be really nice if |
Thanks @fotinakis ! I will remove |
If you're using
|
https://github.com/substack/browserify-handbook#browser-field Thus to ignore Same code:
NOTE: This isn't terribly graceful. If you reinstall packages after this it will override your changes to the |
@nathanph Thanks for the info! Well, having the cls-bluebird dependency obviously turned out to be a pita to begin with. I am currently working on the next version of Request-Promise. In this version cls-bluebird will be dropped altogether. So imho it is best to wait for this version rather than trying to find a better fix for the existing mess... 😉 |
Hey buddies, I just released Thanks everyone for providing workarounds until now. |
request-promise to 4.x request/request-promise#91
This can be removed when the new version of openwhisk is released, which switches from request-promise to needle. References: request/request-promise#91 apache/openwhisk-client-js#78
This can be removed when the new version of openwhisk is released, which switches from request-promise to needle. References: request/request-promise#91 apache/openwhisk-client-js#78
This can be removed when the new version of openwhisk is released, which switches from request-promise to needle. References: request/request-promise#91 apache/openwhisk-client-js#78
When I attempt to import request-promise into my web app I get the following error (using Browserify and Babel to transpile):
My package.json (snipped) is as follows:
Commenting out the
request.bindCLS
line in the library seems to fix the issue with no adverse affect on request-promise. If I use a standardrequire()
to load the module I get the same issue. Do I need to include cls-bluebird as a dependency ? I thought this was removed ...The text was updated successfully, but these errors were encountered: