electron/patches/node/make_module_globalpaths_a_reference.patch
Samuel Attard 9a7426dc25 build: use our patch system to apply patches to upstream node (#19270)
This points our node repo at upstream (nodejs/node) and uses the base node tag as the target ref.  We then use our existing patch system and patch files to apply our changes on top of node.  This unifies how we patch upstream repos and makes our node patches easier to reason, view, understand and most importantly reduce.
2019-07-16 10:23:04 -07:00

26 lines
997 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Sun, 14 Apr 2013 15:54:46 +0800
Subject: Make Module.globalPaths a reference.
We need to hack the search paths of the require function so we can
load libraries from embedded applications without modifications of
node's module code.
(cherry picked from commit 76ba048c37588ee32636817fa7b8dffc64330cbf)
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 2798032fd962398cfd267709644c890377f61b59..1fb197c6c220693b6124f44fbe4b02dd97bcfc4f 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -914,8 +914,8 @@ Module._initPaths = function() {
modulePaths = paths;
- // Clone as a shallow copy, for introspection.
- Module.globalPaths = modulePaths.slice(0);
+ // clone as a shallow copy, for introspection.
+ Module.globalPaths = modulePaths;
};
Module._preloadModules = function(requests) {