Skip to content

Commit

Permalink
fix(gatsby): rename env var for lazy dev bundling to make consistent …
Browse files Browse the repository at this point in the history
…with other experiments (#28150)
  • Loading branch information
KyleAMathews committed Nov 18, 2020
1 parent a612f26 commit 9e3ceec
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby/cache-dir/__tests__/dev-loader-lazy.js
Expand Up @@ -29,15 +29,15 @@ describe(`Dev loader`, () => {
global.__BASE_PATH__ = ``
global.__PATH_PREFIX__ = ``
process.env = Object.assign(process.env, {
GATSBY_EXPERIMENT_LAZY_DEVJS: true,
GATSBY_EXPERIMENTAL_LAZY_DEVJS: true,
})
})

afterEach(() => {
global.__BASE_PATH__ = originalBasePath
global.__PATH_PREFIX__ = originalPathPrefix
process.env = Object.assign(process.env, {
GATSBY_EXPERIMENT_LAZY_DEVJS: false,
GATSBY_EXPERIMENTAL_LAZY_DEVJS: false,
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/app.js
Expand Up @@ -14,7 +14,7 @@ import matchPaths from "$virtual/match-paths.json"
window.___emitter = emitter

let pageComponentRequires
if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
pageComponentRequires = require(`$virtual/lazy-client-sync-requires`)
} else {
pageComponentRequires = require(`$virtual/sync-requires`)
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/dev-loader.js
Expand Up @@ -24,7 +24,7 @@ function mergePageEntry(cachedPage, newPageData) {
class DevLoader extends BaseLoader {
constructor(syncRequires, matchPaths) {
let loadComponent
if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
const ensureComponentInBundle = require(`./ensure-page-component-in-bundle`)
loadComponent = chunkName => ensureComponentInBundle.default(chunkName)
} else {
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/cache-dir/gatsby-browser-entry.js
Expand Up @@ -20,7 +20,7 @@ const StaticQueryContext = React.createContext({})
function StaticQueryDataRenderer({ staticQueryData, data, query, render }) {
let combinedStaticQueryData = staticQueryData

if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
// when we remove the flag, we don't need to combine them
// w/ changes @pieh made.
combinedStaticQueryData = {
Expand Down Expand Up @@ -83,7 +83,7 @@ useStaticQuery(graphql\`${query}\`);
}

let queryNotFound = false
if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
// Merge data loaded via socket.io & xhr
// when we remove the flag, we don't need to combine them
// w/ changes @pieh made.
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/loader.js
Expand Up @@ -144,7 +144,7 @@ export class BaseLoader {
// In development, check if the page is in the bundle yet.
if (
process.env.NODE_ENV === `development` &&
process.env.GATSBY_EXPERIMENT_LAZY_DEVJS
process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS
) {
const ensureComponentInBundle = require(`./ensure-page-component-in-bundle`)
.default
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby/src/bootstrap/requires-writer.ts
Expand Up @@ -187,7 +187,7 @@ export const writeAll = async (state: IGatsbyState): Promise<boolean> => {

let cleanedClientVisitedPageComponents: Array<IGatsbyPageComponent> = components
let notVisitedPageComponents: Array<IGatsbyPageComponent> = components
if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
const clientVisitedPageComponents = [...state.clientVisitedPages.values()]
// Remove any page components that no longer exist.
cleanedClientVisitedPageComponents = components.filter(component =>
Expand Down Expand Up @@ -249,7 +249,7 @@ const preferDefault = m => (m && m.default) || m
// file so we need a seperate one for each webpack instance.
writeModule(`$virtual/ssr-sync-requires`, syncRequires)

if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
// Create file with sync requires of visited page components files.
let lazyClientSyncRequires = `${hotImport}
// prefer default export if available
Expand Down Expand Up @@ -331,7 +331,7 @@ const preferDefault = m => (m && m.default) || m
return true
}

if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
/**
* Start listening to CREATE_CLIENT_VISITED_PAGE events so we can rewrite
* files as required
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby/src/utils/start-server.ts
Expand Up @@ -127,7 +127,7 @@ export async function startServer(
let cancelDevJSNotice: CancelExperimentNoticeCallbackOrUndefined
if (
process.env.gatsby_executing_command === `develop` &&
!process.env.GATSBY_EXPERIMENT_DEVJS_LAZY &&
!process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS &&
!isCI()
) {
cancelDevJSNotice = showExperimentNoticeAfterTimeout(
Expand All @@ -139,7 +139,7 @@ Your friendly Gatsby maintainers detected your site takes longer than ideal to b
If you're interested in trialing out one of these future improvements *today* which should make your local development experience faster, go ahead and run your site with LAZY_DEVJS enabled.
GATSBY_EXPERIMENT_DEVJS_LAZY=true gatsby develop
GATSBY_EXPERIMENTAL_LAZY_DEVJS=true gatsby develop
Please do let us know how it goes (good, bad, or otherwise) at https://gatsby.dev/lazy-devjs-umbrella
`),
Expand All @@ -157,7 +157,7 @@ Please do let us know how it goes (good, bad, or otherwise) at https://gatsby.de

const compiler = webpack(devConfig)

if (process.env.GATSBY_EXPERIMENT_LAZY_DEVJS) {
if (process.env.GATSBY_EXPERIMENTAL_LAZY_DEVJS) {
const bodyParser = require(`body-parser`)
const { boundActionCreators } = require(`../redux/actions`)
const { createClientVisitedPage } = boundActionCreators
Expand Down

0 comments on commit 9e3ceec

Please sign in to comment.