Tenn25 Blog
Gatsbyことはじめ
07.07.20221 Min Read — In other

参考

gatsby new [SITE_DIRECTORY_NAME] [URL_OF_STARTER_GITHUB_REPO]
cd gatsby-site/
gatsby develop

You can now view gatsby-starter-hello-world in the browser.
  http://localhost:8000/

メモ

ファイルを移動したりするとやたらtsconfig.jsonでエラーが出る

https://dev.classmethod.jp/articles/what-to-do-when-a-file-not-found-error-occurs-in-tsconfigjson/

バグらしいので VSCode 再起動で直りそう。

チュートリアル

https://docs.microsoft.com/ja-jp/learn/modules/create-deploy-static-webapp-gatsby-app-service/1-introduction?source=learn

TypeScript で書くので書き換えながら進める

ページのコンポーネントを追加したり GraphQL でデータ取得したり。

GraphQL

http://localhost:8000/\_\_\_graphql

最近触り始めた GraphQL

Gatsby だとgatsby-config.tsに MetaData を書いておき、その情報を GraphQL で取得できたりする。
クエリを JS でエクスポートも出来て GraphiQL 便利だ。