"WebpackError: ReferenceError: fetch is not defined" while building #29492
Replies: 2 comments
-
Gatsby is trying to server-side render your code, It's not clear why your pages are calling that code, but admittedly I've never used firebase. |
Beta Was this translation helpful? Give feedback.
-
your code fails because of what @herecydev said and probably a direct import of the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm new at using Gatsby. I'm trying to build my app which has firebase, in vain. Here below the error display in the terminal. Anyone knows what to do?
Thanks
failed Building static HTML for pages - 1.508s
error Building static HTML failed
662 | * limitations under the License.
663 | */
664 | registerFunctions(firebase, fetch.bind(self));
| ^
665 | firebase.registerVersion(name, version);
666 | //# sourceMappingURL=index.esm.js.map
667 |
WebpackError: ReferenceError: fetch is not defined
package.json infos
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews [email protected]",
"dependencies": {
"@fortawesome/free-regular-svg-icons": "^5.15.2",
"@fortawesome/react-fontawesome": "^0.1.14",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"babel-plugin-styled-components": "^1.12.0",
"babel-preset-gatsby": "^0.12.1",
"emailjs-com": "^2.6.4",
"firebase": "^8.2.7",
"framer-motion": "^3.3.0",
"gatsby": "^2.32.3",
"gatsby-image": "^2.11.0",
"gatsby-plugin-anchor-links": "^1.2.1",
"gatsby-plugin-fontawesome-css": "^1.0.0",
"gatsby-plugin-manifest": "^2.12.0",
"gatsby-plugin-offline": "^3.10.0",
"gatsby-plugin-react-helmet": "^3.10.0",
"gatsby-plugin-react-svg": "^3.0.0",
"gatsby-plugin-sass": "^3.2.0",
"gatsby-plugin-sharp": "^2.14.1",
"gatsby-plugin-styled-components": "^3.10.0",
"gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-source-filesystem": "^2.11.0",
"gatsby-transformer-sharp": "^2.12.0",
"gsap": "^3.6.0",
"joi": "^17.3.0",
"node-fetch": "^2.6.1",
"node-sass": "^5.0.0",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0",
"react-helmet": "^6.1.0",
"react-icons": "^4.2.0",
"react-motion": "^0.5.2",
"react-native-fetch": "^2.0.0",
"react-native-firebase": "^5.6.0",
"react-scroll": "^1.8.1",
"smooth-scrollbar": "^8.6.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.12.13",
"jetifier": "^1.6.6",
"prettier": "2.2.1",
"react-router-dom": "^5.2.0"
},
"keywords": [
"gatsby"
],
"license": "0BSD",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write "**/*.{js,jsx,ts,tsx,json,md}"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo "Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
Beta Was this translation helpful? Give feedback.
All reactions