src: only run preloadModules if the preload array is not empty

PR-URL: https://github.com/nodejs/node/pull/28012
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Samuel Attard 2019-06-02 00:27:17 -07:00 committed by Anto Aravinth
parent abf765e33c
commit 97a42465ab

View File

@ -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