只读编译缓存


🌐 Read-only compile cache

提前生成的缓存,例如在构建时生成并打包进应用,可以通过 readOnly: true(或 NODE_COMPILE_CACHE_READONLY=1)启用。Node.js 会加载目录中的所有条目,但不会写入其中:没有可用条目的模块会像往常一样编译,但不会被持久化,module.flushCompileCache() 不会起作用,如果目录不存在也不会创建。

🌐 A cache that was generated ahead of time, for example at build time to be shipped inside an application package, can be enabled with readOnly: true (or NODE_COMPILE_CACHE_READONLY=1). Node.js then loads whatever entries the directory holds and never writes to it: modules without a usable entry are compiled as usual but not persisted, module.flushCompileCache() is a no-op, and the directory is not created if it is missing.