Open analog-nico opened 8 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.
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.
I think it'd be a big shortcoming if Webpack
and/or browserify
are not supported as they are essential tools nowadays.
@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?
@analog-nico Unfortunately I don't have but if I get it work with webpack
, I'll link it here.
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.
Browserify and Webpack support may be added in the next version. For that we need to work on the points below.
In General:
request
is officially supported in browser environmentsFor Browserify:
test/spec/browserify.js
,test/fixtures/browserify/
)request
still makes sense in this environmentFor Webpack:
test/spec/webpack.js
,test/fixtures/webpack/
)request
still makes sense in this environment