Skip to content

Commit a4827d2

Browse files
committed
fix: only set NODE_COMPILE_CACHE if cache can be enabled
1 parent 83c9937 commit a4827d2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/nuxi/bin/nuxi.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import { fileURLToPath } from 'node:url'
99
if (nodeModule.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
1010
try {
1111
const { directory } = nodeModule.enableCompileCache()
12-
// allow child process to share the same cache directory
13-
process.env.NODE_COMPILE_CACHE ||= directory
12+
if (directory) {
13+
// allow child process to share the same cache directory
14+
process.env.NODE_COMPILE_CACHE ||= directory
15+
}
1416
}
1517
catch {
1618
// Ignore errors

packages/nuxt-cli/bin/nuxi.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import { fileURLToPath } from 'node:url'
99
if (nodeModule.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
1010
try {
1111
const { directory } = nodeModule.enableCompileCache()
12-
// allow child process to share the same cache directory
13-
process.env.NODE_COMPILE_CACHE ||= directory
12+
if (directory) {
13+
// allow child process to share the same cache directory
14+
process.env.NODE_COMPILE_CACHE ||= directory
15+
}
1416
}
1517
catch {
1618
// Ignore errors

0 commit comments

Comments
 (0)