Gatsby: Inconsistent behavior between gatsby develop and gatsby build

Created on 20 Jun 2018  路  2Comments  路  Source: gatsbyjs/gatsby

Description

I report this because I assume that gatsby develop and gatsby build should show the same bebavior in that if gatsby develop compiles, gatsby build should as well.

When there is a GraphQL error, gatsby develop will report the error, ignore it and show compiling successfully while gatsby build will fail in compiling because of the error. So, for a small project, I think it is fine. But if the project was big and developers did not notice errors during development, that might be a problem. For example, in my personal website, I introduced some of them during the development and the website showed normally, but it failed during gatsby build.

Related: #3425

Steps to reproduce

  1. gatsby new gatsby-site
  2. add the following to the end of src/pages/page-2.js:
export const query = graphql`
  query Query {
    error
  }
`
  1. Run gatsby develop and gatsby build

Expected result

gatsby develop and gatsby build both stop due to the GraphQL error.

Actual result

gatsby develop continued to compile successfully while gatsby build stoped

Environment

System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
Binaries:
Yarn: 1.5.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^1.9.247 => 1.9.272
gatsby-link: ^1.6.40 => 1.6.44
gatsby-plugin-react-helmet: ^2.0.10 => 2.0.11

question or discussion

Most helpful comment

Yeah, we're not going to stop the development server on graphql errors. Doing that makes it hard to solve them as you can't then access graphiql. If you'd like to help solve the issue @pieh linked to that'd be great!

All 2 comments

IMO having to re-start gatsby develop after every typo in your graphql queries when developing would be worse DX. That said, having those error show in overlay in browser would defenitely make people notice those (if they would miss those errors) - and we have issue for that https://github.com/gatsbyjs/gatsby/issues/5234

Yeah, we're not going to stop the development server on graphql errors. Doing that makes it hard to solve them as you can't then access graphiql. If you'd like to help solve the issue @pieh linked to that'd be great!

Was this page helpful?
0 / 5 - 0 ratings