0

Is there a single file for the superagent library for React? The github site for it has a huge package and I'm sure I don't need all of that. In my previous project we had just one file and it was doing all the job of making XHR requests. But I've lost that file now.

José Ricardo Pla
  • 1,043
  • 10
  • 16
Rahul Dole
  • 2,723
  • 2
  • 24
  • 30

1 Answers1

2

I do not think they provide the single file but you can build it very easily using browserify. If you have Node and npm installed.

$ npm install -g browserify
$ git clone https://github.com/visionmedia/superagent.git
$ cd superagent
$ git checkout v1.3.0 # check github releases for the latest tag
$ npm install
$ make superagent.js

should get you a file which exports superagent to the window object. Note that the file is not minified, so if you want a minified version, you could run

$ npm install -g uglify-js
$ uglifyjs superagent.js > superagent.min.js
Daniel Perez
  • 6,335
  • 4
  • 24
  • 28
  • Thanks a lot Daniel. But this seems to be different than the react-superagent library. This one seems to be more of the generic type. Will it matter if I use this one? – Rahul Dole Aug 28 '15 at 10:34
  • Btw, I get an error for the line `make superagent.js` It says /usr/bin/env: node: No such file or directory – Rahul Dole Aug 28 '15 at 10:51
  • Aah, got my answer for the make issue here http://stackoverflow.com/a/30281097/1047337 – Rahul Dole Aug 28 '15 at 11:28