@@ -33,17 +33,20 @@ const perf = (function () {
3333
3434perf . mark ( 'renderer/started' ) ;
3535
36- // Setup shell environment
37- process [ 'lazyEnv' ] = getLazyEnv ( ) ;
38-
3936/**
40- * @type {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown } }
37+ * @type {{
38+ * load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown,
39+ * globals: () => typeof import('../../../base/parts/sandbox/electron-sandbox/globals')
40+ * }}
4141 */
4242const bootstrapWindow = ( ( ) => {
4343 // @ts -ignore (defined in bootstrap-window.js)
4444 return window . MonacoBootstrapWindow ;
4545} ) ( ) ;
4646
47+ // Setup shell environment
48+ process [ 'lazyEnv' ] = getLazyEnv ( ) ;
49+
4750// Load workbench main JS, CSS and NLS all in parallel. This is an
4851// optimization to prevent a waterfall of loading to happen, because
4952// we know for a fact that workbench.desktop.main will depend on
@@ -184,22 +187,21 @@ function showPartsSplash(configuration) {
184187 * @returns {Promise<void> }
185188 */
186189function getLazyEnv ( ) {
187-
188- const ipc = require . __$__nodeRequire ( 'electron' ) . ipcRenderer ;
190+ const ipcRenderer = bootstrapWindow . globals ( ) . ipcRenderer ;
189191
190192 return new Promise ( function ( resolve ) {
191193 const handle = setTimeout ( function ( ) {
192194 resolve ( ) ;
193195 console . warn ( 'renderer did not receive lazyEnv in time' ) ;
194196 } , 10000 ) ;
195197
196- ipc . once ( 'vscode:acceptShellEnv' , function ( event , shellEnv ) {
198+ ipcRenderer . once ( 'vscode:acceptShellEnv' , function ( event , shellEnv ) {
197199 clearTimeout ( handle ) ;
198200 Object . assign ( process . env , shellEnv ) ;
199201 // @ts -ignore
200202 resolve ( process . env ) ;
201203 } ) ;
202204
203- ipc . send ( 'vscode:fetchShellEnv' ) ;
205+ ipcRenderer . send ( 'vscode:fetchShellEnv' ) ;
204206 } ) ;
205207}
0 commit comments