How to use the gatsby-cli/lib/reporter.panicOnBuild function in gatsby-cli

To help you get started, we’ve selected a few gatsby-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gatsbyjs / gatsby / packages / gatsby / src / internal-plugins / query-runner / query-compiler.js View on Github external
reportError(message) {
    const queryErrorMessage = `${report.format.red(`GraphQL Error`)} ${message}`
    report.panicOnBuild(queryErrorMessage)
    if (process.env.gatsby_executing_command === `develop`) {
      websocketManager.emitError(overlayErrorID, queryErrorMessage)
      lastRunHadErrors = true
    }
  }
github gatsbyjs / gatsby / packages / gatsby / src / internal-plugins / query-runner / query-compiler.js View on Github external
}

      if (query.isStaticQuery) {
        query.jsonName =
          `sq--` +
          _.kebabCase(
            `${path.relative(store.getState().program.directory, filePath)}`
          )
      }

      if (
        query.isHook &&
        process.env.NODE_ENV === `production` &&
        typeof require(`react`).useContext !== `function`
      ) {
        report.panicOnBuild(
          `You're likely using a version of React that doesn't support Hooks\n` +
            `Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.`
        )
      }

      compiledNodes.set(filePath, query)
    })
github gatsbyjs / gatsby / packages / gatsby / src / query / query-compiler.js View on Github external
}

      if (query.isStaticQuery) {
        query.id =
          `sq--` +
          _.kebabCase(
            `${path.relative(store.getState().program.directory, filePath)}`
          )
      }

      if (
        query.isHook &&
        process.env.NODE_ENV === `production` &&
        typeof require(`react`).useContext !== `function`
      ) {
        report.panicOnBuild(
          `You're likely using a version of React that doesn't support Hooks\n` +
            `Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.`
        )
      }

      compiledNodes.set(filePath, query)
    })
github gatsbyjs / gatsby / packages / gatsby / src / query / query-compiler.js View on Github external
reportError(message) {
    const queryErrorMessage = `${report.format.red(`GraphQL Error`)} ${message}`
    report.panicOnBuild(queryErrorMessage)
    if (process.env.gatsby_executing_command === `develop`) {
      websocketManager.emitError(overlayErrorID, queryErrorMessage)
      lastRunHadErrors = true
    }
  }