Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/nervous-months-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"webpack-cli": patch
---

perf: enable the Node.js compile cache (`module.enableCompileCache`, available on Node.js >= 22.8.0) to speed up CLI startup
12 changes: 12 additions & 0 deletions packages/webpack-cli/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

"use strict";

// `module.enableCompileCache` is only available on Node.js >= 22.8.0
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const { enableCompileCache } = require("node:module");

if (enableCompileCache) {
try {
enableCompileCache();
} catch {
// Ignore errors
}
}

// Prefer the local installation of `webpack-cli` when one exists. Run this
// before requiring the (heavier) CLI implementation: a delegated run then never
// loads it, and `WEBPACK_CLI_SKIP_IMPORT_LOCAL` skips loading `import-local` too.
Expand Down