Logo
    Gatsbyのテストに巻き込まれた話

    Gatsbyのテストに巻き込まれた話

    はじめに

    ゆとり世代の中野です。

    さっそくチャレンジについて書いていきます。

    チャレンジする背景

    • GatsbyがSSRとして動く原因がわかった

    チャレンジ内容

    • GatsbyをSSRさせない方法を残す

    やったこと

    • 開発環境を起動すると以下の文言が出てくる
    • SSRで動くので求めてないのでgatsby-config.jsに設定を追加する
    export const flags = {
      DEV_SSR: false,
    };
    • これで勝手にSSRで動くことはなくなった(infoに出してたTHE_FLAGはなんだったんだろう)

    結論

    • 最初は自分の環境が原因だと思っていたらGatsbyが一部のユーザをテストに参加させてたのが原因でした

    さいごに

    • application側のエラー内容みてもわからなかったのでめっちゃハマった
    Gatsby Config API | Gatsby

    The file gatsby-config.js / gatsby-config.ts defines your site's metadata, plugins, and other general configuration. This file should be...

    www.gatsbyjs.com

    Gatsby Config API | Gatsby

    yutanakano

    WEBエンジニア

    大阪生まれのゆとり世代です

    趣味はバイクでツーリングに行くこと

    愛車は Ninja ZX-25R SE KRT EDITION

    Expoでプロダクトを作っています

    image

    ©ゆとりちゃれんじ

    GitHubXInstagram
    info We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users
    and your site was automatically chosen as one of them. With your help, we'll then release them to everyone in the next minor release.
    
    We greatly appreciate your help testing the change. Please report any feedback good or bad in the umbrella issue. If you do encounter problems, please disable the flag by setting it to false in your gatsby-config.js like:
    
    flags: {
      THE_FLAG: false
    }
    
    The following flags were automatically enabled on your site:
    - DEV_SSR · (Umbrella Issue (https://gatsby.dev/dev-ssr-feedback)) · Server Side Render (SSR) pages on full reloads during develop. Helps you detect SSR bugs and fix them without needing to do full builds. See umbrella issue
    for how to update custom webpack config.