diff --git a/doc/api/cli.md b/doc/api/cli.md index 5c40f209139e5e..d60cf069f9de7f 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2501,6 +2501,34 @@ Any other value will result in colorized output being disabled. [`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the environment variable is arbitrary. +### `NODE_COMPILE_CACHE=dir` + + + +> Stability: 1.1 - Active Development + +When set, whenever Node.js compiles a CommonJS or a ECMAScript Module, +it will use on-disk [V8 code cache][] persisted in the specified directory +to speed up the compilation. This may slow down the first load of a +module graph, but subsequent loads of the same module graph may get +a significant speedup if the contents of the modules do not change. + +To clean up the generated code cache, simply remove the directory. +It will be recreated the next time the same directory is used for +`NODE_COMPILE_CACHE`. + +Compilation cache generated by one version of Node.js may not be used +by a different version of Node.js. Cache generated by different versions +of Node.js will be stored separately if the same directory is used +to persist the cache, so they can co-exist. + +Caveat: currently when using this with [V8 JavaScript code coverage][], the +coverage being collected by V8 may be less precise in functions that are +deserialized from the code cache. It's recommended to turn this off when +running tests to generate precise coverage. + ### `NODE_DEBUG=module[,…]`