question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack bundle for server side execution not working with superagent

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
tdeheurlescommented, Nov 3, 2015

You can try to fix that issue by adding

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

to your webpack config

0reactions
daviscommented, Feb 10, 2016

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack bundle for server side execution not working with ...
I get warnings while bundling and a crash when running a webpack bundle with target 'node'. webpack.config.js: export default { name: 'server', ...
Read more >
Why does bundling Node.js backend api with Webpack fails ...
I'm just trying to execute it in my dev environment manually first. I simply webpack, then try running the bundled js directly (e.g....
Read more >
How to create a server bundle with Webpack for SSR
1. Create Webpack server config ... Open up your webpack.config.js and duplicate your existing client config and name it “server”. We are going...
Read more >
[Solved]-Webpack causes syntax error in bundle output-node.js
to webpack's config fixes superagent for use with webpack. When using the request library, adding the following to webpack's config: node: { "net":...
Read more >
How to Resolve Certificate Errors in a NodeJS App with SSL ...
A practical guide to resolving SSL certificate errors. If you've worked on Node/Express App, you may already know that setting up the app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found