Webpack and request module #3
Comments
I don't think this library is intended for in-browser usage... |
Yes originally the library is not intended to work in the browser but now it works. I am using it inside React components to make HTTP calls to node.js server. As far as I know both request and superagent (https://github.com/visionmedia/superagent) can be used as alternatives to jQuery AJAX I guess most people that are using React are not interested of using jQuery so they need something to communicate with the server. The theory for isomorphic apps :) - http://www.slideshare.net/spikebrehm/2014-0313fluent - says that we have environment agnostic libs (this is the case with request) and shimmed per environment (this is the case for superagent - it has browser property inside package.json to denote browser script that must be included during the build) I just tried to use superagent instead of request....the webpack build now does not have errors but have warnings. I am really curious what is the best approach of using one of these in the browser with webpack... |
Ok than it should ignore {
"browser": {
"net": false,
"tls": false
}
} Or you can do it globally in the webpack configuration with: {
node: {
net: "empty",
tls: "empty"
}
} |
It works with 'node' parameter in webpack configuration. Thanks for the fast answer. |
This is help for me! Thanks for you |
Does not seem to be a part of the package.json spec. I can't see any documentation here https://docs.npmjs.com/files/package.json. Is this is a convention that webpack uses? Thanks. **Edit: Is it related to this spec? https://github.com/defunctzombie/package-browser-field-spec |
any practical solution for this issue? or I have to push the 'eject' and leave the starter? |
Great configurations shown in this project!
I have one question regarding consumption of https://github.com/mikeal/request.
When using webpack with application that uses request module I am getting something like:
ERROR in ./
/request/request.js/request/request.js 32:10-24Module not found: Error: Cannot resolve module 'net' in
@ ./
ERROR in ./
/request//forever-agent/index.jsModule not found: Error: Cannot resolve module 'tls' in
@ ./
/request//forever-agent/index.js 7:10-24Is there a way to make webpack and request working together ?
The text was updated successfully, but these errors were encountered: