Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/rstack/bin/rs.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/env node
import nodeModule from 'node:module';

// enable on-disk code caching of all modules loaded by Node.js
// enable on-disk code caching and share its directory with child workers
// requires Nodejs >= 22.8.0
const { enableCompileCache } = nodeModule;
const { enableCompileCache, constants } = nodeModule;
if (enableCompileCache) {
try {
enableCompileCache();
const { directory, status } = enableCompileCache();
// ALREADY_ENABLED returns the active version-specific cache directory.
// Passing it to workers would append another version directory.
if (directory && status === constants.compileCacheStatus.ENABLED) {
process.env.NODE_COMPILE_CACHE = directory;
Comment thread
chenjiahan marked this conversation as resolved.
}
} catch {
// ignore errors
}
Expand Down