Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack bundle for server side execution not working with superagent #672

Closed
vlinder opened this issue Jun 4, 2015 · 8 comments
Closed

Comments

@vlinder
Copy link

vlinder commented Jun 4, 2015

I get warnings while bundling and a crash when running a webpack bundle with target 'node'.

webpack.config.js:

export default {
    name: 'server',
    target: 'node',
    ...
}

Bundling warnings:

WARNING in ./~/superagent/~/formidable/lib/incoming_form.js
Critical dependencies:
3:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/superagent/~/formidable/lib/incoming_form.js 3:43-50

WARNING in ./~/superagent/~/formidable/lib/file.js
Critical dependencies:
3:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/superagent/~/formidable/lib/file.js 3:43-50

WARNING in ./~/superagent/~/formidable/lib/json_parser.js
Critical dependencies:
3:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/superagent/~/formidable/lib/json_parser.js 3:43-50

WARNING in ./~/superagent/~/formidable/lib/querystring_parser.js
Critical dependencies:
3:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/superagent/~/formidable/lib/querystring_parser.js 3:43-50

Crash when bundle is run:

    var fs = require('fs');
             ^
TypeError: undefined is not a function
@defunctzombie
Copy link
Contributor

sounds like some webpack issue. Maybe ask them to help

@carlos09
Copy link

I'm having this same issue. Seeing this when i try using superagent. Any luck with this issue? @vlinder

@tdeheurles
Copy link

You can try to fix that issue by adding

plugins: [
    new webpack.DefinePlugin({ "global.GENTLY": false })
],

to your webpack config

@vlinder
Copy link
Author

vlinder commented Dec 4, 2015

That is what solved my problem.

@davis
Copy link
Contributor

davis commented Feb 10, 2016

@tdeheurles do you mind sharing the rest of your config? I'm still running into this issue

@tdeheurles
Copy link

I'll try to find... I’m not sure the project is fine. I can’t remind but maybe it’s the one where I finished with babel-cli ...

@tdeheurles
Copy link

@davis sorry, have looked to my commit and I can’t find ... Do you run targeting node ?

@davis
Copy link
Contributor

davis commented Feb 10, 2016

I got around it by removing some lines from the bundle after building. Inconvenient, but works for now. Thanks though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants