Skip to content

Commit

Permalink
perf(cli): enable Node.js compile cache
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Nov 4, 2024
1 parent e014ad6 commit 2b12240
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/rspack-cli/bin/rspack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env node
const nodeModule = require("node:module");

// enable on-disk code caching of all modules loaded by Node.js
// requires Nodejs >= 22.8.0
const { enableCompileCache } = nodeModule;
if (enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
try {
enableCompileCache();
} catch {
// ignore errors
}
}

const { RspackCLI } = require("../dist/index");

async function runCLI() {
Expand Down

0 comments on commit 2b12240

Please sign in to comment.