-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Closed
Labels
help wantedIssue with a clear description that the community can help with.Issue with a clear description that the community can help with.type: bugAn issue or pull request relating to a bug in GatsbyAn issue or pull request relating to a bug in Gatsby
Description
Description
v2 gatsbygram doesn't build, failing with a window is not defined error. Disabling the gatsby-plugin-manifest plugin avoids the error for gatsby develop, but not gatsby build.
Gatsbygram's gatsby-browser.js references window which triggers the error.
This seems to be caused by import { apiRunner } from "./api-runner-browser" in cache-dir/loader.js in addition to importing from gatsby in the manifest plugin's gatsby-ssr.js.
Steps to reproduce
In the v2 branch, run yarn run dev or yarn run build on the gatsbygram example.
Expected result
The site should build
Actual result
The build fails with the following error:
ReferenceError: window is not defined
- render-page.js:1558 Object../gatsby-browser.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:1558:19
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:114 Object../.cache/api-runner-browser-plugins.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:114:11
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:131 Object../.cache/api-runner-browser.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:131:15
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:860 Object../.cache/loader.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:860:78
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:659 Object.<anonymous>
/gatsby-v2/examples/gatsbygram/public/render-page.js:659:65
- render-page.js:691 Object../.cache/gatsby-browser-entry.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:691:30
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:7564 Object../node_modules/gatsby-plugin-manifest/gatsby-ssr.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:7564:15
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:179 Object../.cache/api-runner-ssr.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:179:11
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:439 Object.<anonymous>
/gatsby-v2/examples/gatsbygram/public/render-page.js:439:73
- render-page.js:532 Object../.cache/develop-static-entry.js
/gatsby-v2/examples/gatsbygram/public/render-page.js:532:30
- render-page.js:30 __webpack_require__
/gatsby-v2/examples/gatsbygram/public/render-page.js:30:30
- render-page.js:79
/gatsby-v2/examples/gatsbygram/public/render-page.js:79:18
- render-page.js:82
/gatsby-v2/examples/gatsbygram/public/render-page.js:82:10
- render-page.js:3 webpackUniversalModuleDefinition
/gatsby-v2/examples/gatsbygram/public/render-page.js:3:20
- render-page.js:10 Object.<anonymous>
/gatsby-v2/examples/gatsbygram/public/render-page.js:10:3
Environment
- Gatsby version (
npm list gatsby): next - gatsby-cli version (
gatsby --version): next - Node.js version: 8.11.1 (lts/carbon)
- Operating System: MacOS 10.13.4
File contents
See https://github.com/gatsbyjs/gatsby/tree/v2/examples/gatsbygram
Metadata
Metadata
Assignees
Labels
help wantedIssue with a clear description that the community can help with.Issue with a clear description that the community can help with.type: bugAn issue or pull request relating to a bug in GatsbyAn issue or pull request relating to a bug in Gatsby