Skip to content

Commit

Permalink
handle case when FAST_REFRESH flag is set and GATSBY_HOT_LOADER env v…
Browse files Browse the repository at this point in the history
…ar is set to something else than fast-refresh
  • Loading branch information
pieh committed Dec 1, 2020
1 parent 9c0cd97 commit c803d2b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/gatsby/src/services/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ export async function initialize({

// Setup flags
if (config && config.flags) {
// TODO: this should be handled in FAST_REFRESH configuration and not be one-off here.
if (
config.flags.FAST_REFRESH &&
process.env.GATSBY_HOT_LOADER &&
process.env.GATSBY_HOT_LOADER !== `fast-refresh`
) {
delete config.flags.FAST_REFRESH
reporter.warn(
reporter.stripIndent(`
Both FAST_REFRESH gatsby-config flag and GATSBY_HOT_LOADER environment variable is used with conflicting setting ("${process.env.GATSBY_HOT_LOADER}").
Will use react-hot-loader.
To use Fast Refresh either do not use GATSBY_HOT_LOADER environment variable or set it to "fast-refresh".
`)
)
}
const availableFlags = require(`../utils/flags`).default
// Get flags
const { enabledConfigFlags, unknownFlagMessage, message } = handleFlags(
Expand Down

0 comments on commit c803d2b

Please sign in to comment.