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
…28179)

* feat(gatsby): add telemetry for usage of lazy devjs bundling (#28147)

* feat(gatsby): add telemetry for usage of lazy devjs bundling

* fix name

* Use pascal convention for name

(cherry picked from commit 48f2b2d)

* feat(gatsby): enable all dev improvements with one env var (#28166)

* feat(gatsby): enable all dev improvements with one env var

* Address feedback

* fix

(cherry picked from commit 158ceb7)

Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
  • Loading branch information
vladar and KyleAMathews authored Nov 19, 2020
1 parent 57b5840 commit 9869094
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion 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,11 +222,18 @@ 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(`ExperimentalLazyDevjs`)
}

// run stale jobs
store.dispatch(removeStaleJobs(store.getState()))

Expand Down

0 comments on commit 9869094

Please sign in to comment.