bootstrap - fix loader paths for running out of sources

This commit is contained in:
Benjamin Pasero
2021-09-06 07:53:01 +02:00
parent 05cc11ed98
commit 8ce218ca26

View File

@@ -43,9 +43,10 @@
* }} [options]
*/
async function load(modulePaths, resultCallback, options) {
const isDev = !!safeProcess.env['VSCODE_DEV'];
// Error handler (TODO@sandbox non-sandboxed only)
let showDevtoolsOnError = !!safeProcess.env['VSCODE_DEV'];
let showDevtoolsOnError = isDev;
safeProcess.on('uncaughtException', function (/** @type {string | Error} */ error) {
onUnexpectedError(error, showDevtoolsOnError);
});
@@ -75,8 +76,8 @@
disallowReloadKeybinding: false,
removeDeveloperKeybindingsAfterLoad: false
};
showDevtoolsOnError = safeProcess.env['VSCODE_DEV'] && !forceDisableShowDevtoolsOnError;
const enableDeveloperKeybindings = safeProcess.env['VSCODE_DEV'] || forceEnableDeveloperKeybindings;
showDevtoolsOnError = isDev && !forceDisableShowDevtoolsOnError;
const enableDeveloperKeybindings = isDev || forceEnableDeveloperKeybindings;
let developerDeveloperKeybindingsDisposable;
if (enableDeveloperKeybindings) {
developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(disallowReloadKeybinding);
@@ -127,17 +128,18 @@
// Teach the loader the location of the node modules we use in renderers
// This will enable to load these modules via <script> tags instead of
// using a fallback such as node.js require which does not exist in sandbox
const baseNodeModulesPath = isDev ? '../node_modules' : '../node_modules.asar';
loaderConfig.paths = {
'vscode-textmate': '../node_modules.asar/vscode-textmate/release/main.js',
'vscode-oniguruma': '../node_modules.asar/vscode-oniguruma/release/main.js',
'xterm': '../node_modules.asar/xterm/lib/xterm.js',
'xterm-addon-search': '../node_modules.asar/xterm-addon-search/lib/xterm-addon-search.js',
'xterm-addon-unicode11': '../node_modules.asar/xterm-addon-unicode11/lib/xterm-addon-unicode11.js',
'xterm-addon-webgl': '../node_modules.asar/xterm-addon-webgl/lib/xterm-addon-webgl.js',
'iconv-lite-umd': '../node_modules.asar/iconv-lite-umd/lib/iconv-lite-umd.js',
'jschardet': '../node_modules.asar/jschardet/dist/jschardet.min.js',
'@vscode/vscode-languagedetection': '../node_modules.asar/@vscode/vscode-languagedetection/dist/lib/index.js',
'tas-client-umd': '../node_modules.asar/tas-client-umd/lib/tas-client-umd.js'
'vscode-textmate': `${baseNodeModulesPath}/vscode-textmate/release/main.js`,
'vscode-oniguruma': `${baseNodeModulesPath}/vscode-oniguruma/release/main.js`,
'xterm': `${baseNodeModulesPath}/xterm/lib/xterm.js`,
'xterm-addon-search': `${baseNodeModulesPath}/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-unicode11': `${baseNodeModulesPath}/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
'xterm-addon-webgl': `${baseNodeModulesPath}/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'iconv-lite-umd': `${baseNodeModulesPath}/iconv-lite-umd/lib/iconv-lite-umd.js`,
'jschardet': `${baseNodeModulesPath}/jschardet/dist/jschardet.min.js`,
'@vscode/vscode-languagedetection': `${baseNodeModulesPath}/@vscode/vscode-languagedetection/dist/lib/index.js`,
'tas-client-umd': `${baseNodeModulesPath}/tas-client-umd/lib/tas-client-umd.js`
};
// For priviledged renderers, allow to load built-in and other node.js