From e14d874adbb59c31cf7d155ac65e090e49e4bc1c Mon Sep 17 00:00:00 2001 From: Johannes Date: Thu, 17 Nov 2022 17:49:43 +0100 Subject: [PATCH] define globals for server-main too --- src/server-main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/server-main.js b/src/server-main.js index 3dbbeaedf54..04a3161c825 100644 --- a/src/server-main.js +++ b/src/server-main.js @@ -259,6 +259,19 @@ function loadCode() { return new Promise((resolve, reject) => { const path = require('path'); + // VSCODE_GLOBALS: node_modules + globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { + get(target, mod) { + if (!target[mod] && typeof mod === 'string') { + target[mod] = require(mod); + } + return target[mod]; + } + }); + // VSCODE_GLOBALS: package/product.json + globalThis._VSCODE_PRODUCT_JSON = require('../product.json'); + globalThis._VSCODE_PACKAGE_JSON = require('../package.json'); + delete process.env['ELECTRON_RUN_AS_NODE']; // Keep bootstrap-amd.js from redefining 'fs'. // See https://github.com/microsoft/vscode-remote-release/issues/6543