Skip to content

Commit a1227f8

Browse files
committed
change LIMIT_CPU to LIMIT_CPUS to control the number of cpus used
1 parent 4d1f445 commit a1227f8

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ IS_PREVIEW_DEPLOY=false
2424
# Note: always include `en` as it is the default lang of the site
2525
BUILD_LOCALES=
2626

27-
# If resource constraints are being hit during builds, change LIMIT_CPU to `true`
28-
# to limit the demand during build time
29-
LIMIT_CPU=false
27+
# If resource constraints are being hit during builds, change LIMIT_CPUS to a
28+
# fixed number of CPUs (e.g. 2) to limit the demand during build time
29+
LIMIT_CPUS=

next.config.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ const { PHASE_DEVELOPMENT_SERVER } = require("next/constants")
22

33
const { i18n } = require("./next-i18next.config")
44

5-
const experimental =
6-
(process.env.LIMIT_CPU || "").toLowerCase() === "true"
7-
? {
8-
// This option could be enabled in the future when flagged as stable, to speed up builds
9-
// (see https://nextjs.org/docs/pages/building-your-application/configuring/mdx#using-the-rust-based-mdx-compiler-experimental)
10-
// mdxRs: true,
11-
12-
// Reduce the number of cpus and disable parallel threads in prod envs to consume less memory
13-
workerThreads: false,
14-
cpus: 2,
15-
}
16-
: {}
5+
const LIMIT_CPUS = Number(process.env.LIMIT_CPUS || 2)
6+
7+
const experimental = LIMIT_CPUS
8+
? {
9+
// This option could be enabled in the future when flagged as stable, to speed up builds
10+
// (see https://nextjs.org/docs/pages/building-your-application/configuring/mdx#using-the-rust-based-mdx-compiler-experimental)
11+
// mdxRs: true,
12+
13+
// Reduce the number of cpus and disable parallel threads in prod envs to consume less memory
14+
workerThreads: false,
15+
cpus: LIMIT_CPUS,
16+
}
17+
: {}
1718

1819
/** @type {import('next').NextConfig} */
1920
module.exports = (phase, { defaultConfig }) => {

0 commit comments

Comments
 (0)