There was an error while loading. Please reload this page.
1 parent 43905a6 commit fc0678bCopy full SHA for fc0678b
1 file changed
packages/rstack/bin/rs.js
@@ -1,12 +1,17 @@
1
#!/usr/bin/env node
2
import nodeModule from 'node:module';
3
4
-// enable on-disk code caching of all modules loaded by Node.js
+// enable on-disk code caching and share its directory with child workers
5
// requires Nodejs >= 22.8.0
6
-const { enableCompileCache } = nodeModule;
+const { enableCompileCache, constants } = nodeModule;
7
if (enableCompileCache) {
8
try {
9
- enableCompileCache();
+ const { directory, status } = enableCompileCache();
10
+ // ALREADY_ENABLED returns the active version-specific cache directory.
11
+ // Passing it to workers would append another version directory.
12
+ if (directory && status === constants.compileCacheStatus.ENABLED) {
13
+ process.env.NODE_COMPILE_CACHE = directory;
14
+ }
15
} catch {
16
// ignore errors
17
}
0 commit comments