From 506c060d6092cd82074ca1cb1c39dac2de0ac8bf Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 18 Nov 2020 13:41:08 -0800 Subject: [PATCH 1/3] feat(gatsby): enable all dev improvements with one env var --- packages/gatsby/src/services/initialize.ts | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/gatsby/src/services/initialize.ts b/packages/gatsby/src/services/initialize.ts index 50c4af08a0502..791f5afe9bb19 100644 --- a/packages/gatsby/src/services/initialize.ts +++ b/packages/gatsby/src/services/initialize.ts @@ -32,6 +32,31 @@ interface IPluginResolution { options: IPluginInfoOptions } +// If the env variable GATSBY_EXPERIMENTAL_FAST_DEV is set, enable +// all DEV experimental changes (but only during development & not on CI). +if ( + process.env.gatsby_executing_command === `develop` && + process.env.GATSBY_EXPERIMENTAL_FAST_DEV && + !isCI() +) { + process.env = { + ...process.env, + GATSBY_EXPERIMENTAL_LAZY_DEVJS: `true`, + GATSBY_EXPERIMENTAL_QUERY_ON_DEMAND: `true`, + GATSBY_EXPERIMENTAL_DEV_SSR: `true`, + } + + reporter.info(` +Three fast dev experiments are enabled, Lazy Bundling, Query on Demand, and Development SSR. + +Please give feedback on their respective umbrella issues! + +- https://gatsby.dev/lazy-devjs-umbrella +- https://gatsby.dev/query-on-demand-feedback +- https://gatsby.dev/dev-ssr-feedback + `) +} + if ( process.env.gatsby_executing_command === `develop` && !process.env.GATSBY_EXPERIMENTAL_DEV_SSR && From f07e9cc1cc98b825989fe2486371b1ee6533de43 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 18 Nov 2020 14:01:39 -0800 Subject: [PATCH 2/3] Address feedback --- packages/gatsby/src/services/initialize.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/gatsby/src/services/initialize.ts b/packages/gatsby/src/services/initialize.ts index 791f5afe9bb19..e7e7063f332a9 100644 --- a/packages/gatsby/src/services/initialize.ts +++ b/packages/gatsby/src/services/initialize.ts @@ -39,12 +39,9 @@ if ( process.env.GATSBY_EXPERIMENTAL_FAST_DEV && !isCI() ) { - process.env = { - ...process.env, - GATSBY_EXPERIMENTAL_LAZY_DEVJS: `true`, - GATSBY_EXPERIMENTAL_QUERY_ON_DEMAND: `true`, - GATSBY_EXPERIMENTAL_DEV_SSR: `true`, - } + process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS = `true` + process.env.GATSBY_EXPERIMENTAL_QUERY_ON_DEMAND = `true` + process.env.GATSBY_EXPERIMENTAL_DEV_SSR = `true` reporter.info(` Three fast dev experiments are enabled, Lazy Bundling, Query on Demand, and Development SSR. @@ -225,13 +222,13 @@ export async function initialize({ `Experimental Query on Demand feature is not available in CI environment. Continuing with regular mode.` ) } else { - reporter.info(`Using experimental Query on Demand feature`) + // We already show a notice for this flag. + if (!process.env.GATSBY_EXPERIMENTAL_FAST_DEV) { + reporter.info(`Using experimental Query on Demand feature`) + } telemetry.trackFeatureIsUsed(`QueryOnDemand`) } } - if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) { - telemetry.trackFeatureIsUsed(`ExperimentalDevSSR`) - } // run stale jobs store.dispatch(removeStaleJobs(store.getState())) From d2275ef3881681dd32650f747b014189c3dd2e20 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 18 Nov 2020 14:35:05 -0800 Subject: [PATCH 3/3] fix --- packages/gatsby/src/services/initialize.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/gatsby/src/services/initialize.ts b/packages/gatsby/src/services/initialize.ts index e7e7063f332a9..8da75b4c4805a 100644 --- a/packages/gatsby/src/services/initialize.ts +++ b/packages/gatsby/src/services/initialize.ts @@ -230,6 +230,10 @@ export async function initialize({ } } + if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) { + telemetry.trackFeatureIsUsed(`ExperimentalLazyDevjs`) + } + // run stale jobs store.dispatch(removeStaleJobs(store.getState()))