LoginSignup
2
0

More than 3 years have passed since last update.

GatsbyでPlaygroundを使用する時(GraphQL)

Last updated at Posted at 2021-03-18

参考

Gatsbyノート2(Markdown/GraphQL Playground)
最短・最速で学ぶ React製 静的サイトジェネレータ GatsbyJS + CMS Contentfulブログ実装編

npm run developを使用する

gatsby developではなくnpm run developを使用してhttp://localhost:8000/___graphqlにアクセスする

スクリーンショット 2021-03-18 10.38.11.png

どゆこと? package.jsonを編集する

package.json

"scripts": {
    "build": "gatsby build",
    "develop": "GATSBY_GRAPHQL_IDE=playground gatsby 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"
  },

package.jsonのscriptsのdevelopにGATSBY_GRAPHQL_IDE=playgroundを追加編集後、

Gatsby develop

ではここが呼ばれずにデフォルトのツールが起動。

npm run develop

でpackage.jsonが反映される、という挙動でした。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0