diff --git a/packages/gatsby/src/services/initialize.ts b/packages/gatsby/src/services/initialize.ts index 50c4af08a0502..8da75b4c4805a 100644 --- a/packages/gatsby/src/services/initialize.ts +++ b/packages/gatsby/src/services/initialize.ts @@ -32,6 +32,28 @@ 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.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. + +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 && @@ -200,12 +222,16 @@ 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`) + telemetry.trackFeatureIsUsed(`ExperimentalLazyDevjs`) } // run stale jobs