Skip to content
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

[v2] gatsbygram build fails #5354

Closed
m-allanson opened this issue May 10, 2018 · 2 comments
Closed

[v2] gatsbygram build fails #5354

m-allanson opened this issue May 10, 2018 · 2 comments
Labels
help wanted Issue with a clear description that the community can help with. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@m-allanson
Copy link
Contributor

m-allanson commented May 10, 2018

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

@m-allanson m-allanson added type: bug An issue or pull request relating to a bug in Gatsby help wanted Issue with a clear description that the community can help with. labels May 10, 2018
m-allanson added a commit to m-allanson/gatsby that referenced this issue May 10, 2018
This was referenced May 10, 2018
@nihgwu
Copy link
Contributor

nihgwu commented May 10, 2018

I fixed it locally

@m-allanson
Copy link
Contributor Author

This is fixed, thanks @nihgwu 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants