Skip to content

Commit

Permalink
feat(gatsby): enable all dev improvements with one env var (#28166)
Browse files Browse the repository at this point in the history
* feat(gatsby): enable all dev improvements with one env var

* Address feedback

* fix

(cherry picked from commit 158ceb7)
  • Loading branch information
KyleAMathews authored and vladar committed Nov 19, 2020
1 parent 2dd0704 commit 52a4ce5
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions packages/gatsby/src/services/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 52a4ce5

Please sign in to comment.