Skip to content

Commit 1b4fc8b

Browse files
committed
perf(fmt): share compile cache with workers
1 parent 133c057 commit 1b4fc8b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/rstack/bin/rs.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#!/usr/bin/env node
22
import nodeModule from 'node:module';
33

4-
// enable on-disk code caching of all modules loaded by Node.js
4+
// enable on-disk code caching and share its directory with child workers
55
// requires Nodejs >= 22.8.0
66
const { enableCompileCache } = nodeModule;
77
if (enableCompileCache) {
88
try {
9-
enableCompileCache();
9+
const { directory } = enableCompileCache();
10+
if (directory) {
11+
process.env.NODE_COMPILE_CACHE = directory;
12+
}
1013
} catch {
1114
// ignore errors
1215
}

0 commit comments

Comments
 (0)