Webpack bundle for server side execution not working with superagent
See original GitHub issueI 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:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can try to fix that issue by adding
to your webpack config
I got around it by removing some lines from the bundle after building. Inconvenient, but works for now. Thanks though!