request / request-promise

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.
ISC License
4.77k stars 297 forks source link

Browserify and Webpack support #93

Open analog-nico opened 8 years ago

analog-nico commented 8 years ago

Browserify and Webpack support may be added in the next version. For that we need to work on the points below.

In General:

For Browserify:

For Webpack:

ryderlee commented 7 years ago

Hi. Wanna ask such issue is saying the package does not support webpack and browserify? I just switch from browserify to webpack and now I am having trouble using request-promise to do http-post. (it works when I was using browserify) So I would like to clarify that.

analog-nico commented 7 years ago

Hi @ryderlee , browserify and webpack are not officially supported. However, many still use request-promise with both successfully. Since request-promise uses request and request uses node core libraries the challenge with webpack is to include browser versions of the node core libraries in the build. For further info read this issue.

ngocketit commented 7 years ago

I think it'd be a big shortcoming if Webpack and/or browserify are not supported as they are essential tools nowadays.

analog-nico commented 7 years ago

@ngocketit Absolutely! I'd welcome your contributions in regards to the TODOs at the top. In particular, do you have a working example of a good configuration for Webpack?

ngocketit commented 7 years ago

@analog-nico Unfortunately I don't have but if I get it work with webpack, I'll link it here.

IAMtheIAM commented 6 years ago

Adding this single library, request-promise increases my webpack 4 production bundle from 40kb to 1165kb, while adding thousands of js files via submodules.

What is the purpose of all this code? I highly recommend switching to an import/export style so webpack can statically analyze what code is actually being called in the final bundle, and drop the rest. That would shrink it down significantly.