define globals for server-main too

pull/166686/head
Johannes 2022-11-17 17:49:43 +01:00
parent 824c70b275
commit e14d874adb
No known key found for this signature in database
GPG Key ID: 6DEF802A22264FCA
1 changed files with 13 additions and 0 deletions

View File

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