-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Superagent for Webpack
Petr Bela edited this page Mar 2, 2015
·
4 revisions
For Webpack add:
plugins.push(new webpack.DefinePlugin({ "global.GENTLY": false }));
and
node: {
__dirname: true,
fs: 'empty'
}
to webpack's config.
Since superagent require
s its package.json
at one point, you'll also need json-loader otherwise you'll be getting
ERROR in node_modules/superagent/package.json
Module parse failed: node_modules/superagent/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "name": "superagent",
| "version": "0.21.0",
| "description": "elegant & feature rich browser / node HTTP with a fluent API",
@ node_modules/superagent/lib/node/index.js 24:10-39
To fix it, install the package:
npm i json-loader --save
and set it in webpack config:
module: {
loaders: [ {test: /\.json$/, loader: 'json' } ]
}