From 97a42465ab6f2e1cce33ca7a0d9cc6e8eea145f9 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Sun, 2 Jun 2019 00:27:17 -0700 Subject: [PATCH] src: only run preloadModules if the preload array is not empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/28012 Reviewed-By: Michaƫl Zasso Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Yongsheng Zhang Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: Ruben Bridgewater --- lib/internal/bootstrap/pre_execution.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index ed5a5afe4b8072..e9571a89a62857 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -385,7 +385,7 @@ function initializeFrozenIntrinsics() { function loadPreloadModules() { // For user code, we preload modules if `-r` is passed const preloadModules = getOptionValue('--require'); - if (preloadModules) { + if (preloadModules && preloadModules.length > 0) { const { Module: { _preloadModules