Files
James M Snell 2413907a12 module: add isPreloading indicator
Adds a `module.isPreloading` property that is `true` only during the
preload (`-r`) phase of Node.js bootstrap. This provides modules an
easy, non-hacky way of knowing if they are being loaded during preload.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/36263
Backport-PR-URL: https://github.com/nodejs/node/pull/36988
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-04-25 08:22:12 +02:00

3 lines
63 B
JavaScript

const assert = require('assert');
assert(module.isPreloading);