Skip to content

Commit f3f7977

Browse files
authored
Merge pull request #7487 from layer5io/fix/gatsby-lite-dev-memory
fix(dev): reduce Gatsby local memory usage
2 parents d65f772 + 6856858 commit f3f7977

File tree

32 files changed

+897
-649
lines changed

32 files changed

+897
-649
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ Environment variables are named values used to configure how an application beha
519519
| Variable | Possible Values | Description |
520520
|---------|----------------|------------|
521521
| `BUILD_FULL_SITE` | `true`, `false` | When set to `true`, enables a full site build including all collections. If not explicitly set to `true`, the project defaults to a lightweight build. |
522+
| `LITE_BUILD_PROFILE` | `content`, `core` | Selects which collections are excluded when `BUILD_FULL_SITE=false`. `core` is the default for `make site`, `npm start`, and `npm run dev`, while `content` keeps blog, news, events, and resources enabled. |
523+
| `BUILD_COLLECTIONS_EXCLUDE` | comma-separated collection names | Adds extra collections to exclude from a lightweight build without editing project files. |
522524
| `NODE_ENV` | `development`, `production` | Determines the build and rendering mode used by Gatsby. This is automatically set by Gatsby. <br><br>• `development` - Uses **Deferred Static Generation (DSG)** i.e pages built on demand for faster startup. <br>• `production` - Uses **Server-Side Rendering (SSR)** i.e pages rendered on each request for fresh content. |
523525
| `CI` | `true`, `false` | Indicates that the build is running in a **Continuous Integration (CI)** environment (e.g., GitHub Actions). When set to `true`, special logic is applied to page paths and redirects for GitHub Pages compatibility. This is typically set automatically by the CI system and does not need to be configured manually. |
524526

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ setup:
2121
# "make site" - The default lightweight build keeps the dev server fast by skipping heavy collections.
2222
## Run a partial build of layer5.io on your local machine.
2323
site:
24-
@echo "🏗️ Building lightweight site version (excluding Members and Integrations collections)..."
24+
@echo "🏗️ Building lightweight site version (core profile excludes Members, Integrations, Blog, News, Events, and Resources collections)..."
25+
@echo " Use LITE_BUILD_PROFILE=content make site to include content collections while still skipping the heaviest routes."
2526
@npm run develop:lite
2627

2728
# "make site-full" forces the dev server to include every collection.
@@ -32,7 +33,7 @@ site-full:
3233

3334
## Run layer5.io on your local machine. Alternate method.
3435
site-fast:
35-
NODE_OPTIONS=--max-old-space-size=8192 gatsby develop
36+
BUILD_FULL_SITE=false LITE_BUILD_PROFILE=core GATSBY_CPU_COUNT=4 SHARP_CONCURRENCY=4 UV_THREADPOOL_SIZE=4 NODE_OPTIONS=--max-old-space-size=8192 gatsby develop
3637

3738
## Build layer5.io on your local machine.
3839
build:

gatsby-browser.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import "./fonts.css";
22
import "slick-carousel/slick/slick.css";
33
import "slick-carousel/slick/slick-theme.css";
44

5+
export const disableCorePrefetching = () =>
6+
process.env.NODE_ENV === "development";
7+
58
document.addEventListener("DOMContentLoaded", () => {
69
/** init gtm after 3500 seconds - this could be adjusted */
710
setTimeout(initGTM, 3500);

0 commit comments

Comments
 (0)