Skip to content

Commit

Permalink
perf: use module.enableCompileCache in NodeJS v22
Browse files Browse the repository at this point in the history
  • Loading branch information
lvqq authored Nov 16, 2024
1 parent d732259 commit 0b52ec6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sources/corepackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,11 @@ export async function runVersion(locator: Locator, installSpec: InstallSpec & {s
// Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache
// $ docker run -it node:20.3.0-slim corepack [email protected] --version
// [SIGSEGV]
if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`))
// @ts-expect-error - No types
await import(`v8-compile-cache`);
if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) {
if (!Module.enableCompileCache?.())

Check failure on line 407 in sources/corepackUtils.ts

View workflow job for this annotation

GitHub Actions / Testing chores

Property 'enableCompileCache' does not exist on type 'typeof Module'.
// @ts-expect-error - No types
await import(`v8-compile-cache`);
}

// We load the binary into the current process,
// while making it think it was spawned.
Expand Down

0 comments on commit 0b52ec6

Please sign in to comment.