-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
GatsbyJS & Superagent: WebpackError: require is not a function #2615
Comments
Better to use a library designed for the browser like axios. It looks like webpack is complaining when superagent tries to require node code. |
@KyleAMathews - I agree, but Superagent does have a browser target. However, it relies on the Webpack |
Is there a particular reason |
I've just come across this issue as well. I'm using Auth0 for authentication and this is what I'm getting:
|
Hmmm not sure now actually why that isn't always |
Turns out it was an issue in a dependency of superagent as documented here: node-formidable/formidable#337 |
@KyleAMathews Just tested it, setting to Let me know if you want me to send in a PR to change this! |
@ethanlee16 Still seeing this years later... would love to get it fixed in the platform |
Still seeing this issue as well. Tried editing gatsby webpack config locally, no luck. Also tried adjusting gatsby-node.js to set GENTLY to false as that fix has been mentioned elsewhere, still no luck. Annoyingly can't easily switch package as the API we're using needs some of superagents functionality. @probablyup, I don't suppose you found anything? |
I ended up switching to a different package |
Anyone looking for a solution, this fixed it for me: https://stackoverflow.com/a/47949253/222479 |
I'm trying to build my react app into static html pages with gatsbyjs. I just tried 'gatsby build', and it goes through everything fine until it wants to create the static pages, then I get:
I am using npm 5.5.1.
I just commented out superagent in my contact.js file, and the build goes through fine. However, I don't understand why this should cause any problems:
contact.js:
The text was updated successfully, but these errors were encountered: