Skip to content

Commit de71d3f

Browse files
authored
perf(CLI): enable Node cache before loading modules (#366)
1 parent 409fb35 commit de71d3f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/core/bin/rslib.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
#!/usr/bin/env node
2-
import { logger, prepareCli, runCli } from '../dist/index.js';
2+
import nodeModule from 'node:module';
3+
4+
// enable on-disk code caching of all modules loaded by Node.js
5+
// requires Nodejs >= 22.8.0
6+
const { enableCompileCache } = nodeModule;
7+
if (enableCompileCache) {
8+
try {
9+
enableCompileCache();
10+
} catch {
11+
// ignore errors
12+
}
13+
}
314

415
async function main() {
16+
const { logger, prepareCli, runCli } = await import('../dist/index.js');
517
prepareCli();
618

719
try {

0 commit comments

Comments
 (0)