Node.js 22.8.0, the most recent launch of the event-driven JavaScript runtime, provides a JavaScript API to allow on-disk caching of all modules loaded after the API is named, presenting a caching choice for code.
The API is named module.allow.CompileCache()
. It overrides the NODE_COMPILE_CACHE
setting variable, which solely finish customers might use to allow on-disk caching. The brand new API lets instrument and library authors handle the caching of their very own code. The answer is a built-in different to v8-compile-cache packages, providing higher efficiency and help for ESM (ECMAScript Modules).
Launched on September 3, Node 22.8.0 may be downloaded from Nodejs.org. It’s labeled as a present launch reasonably than an LTS (long-term help) launch. With this replace, Node now helps requiring code protection to satisfy a selected threshold earlier than a course of efficiently exits. Builders who need to use this functionality should set the –experimental-test-coverage
flag. Thresholds may be set for forms of protection together with department, operate, and line coverages. Additionally in model 22.8.0, a taste of vm.createContext()
has been added to create a context with out contextifying its international object when vm.constants.DONT_CONTEXTIFY
is used. That is appropriate when customers need to freeze the context or velocity up international entry if they don’t want the interceptor habits.