diff --git a/build/package.json b/build/package.json index 42e67a02b0d..4270709f2f8 100644 --- a/build/package.json +++ b/build/package.json @@ -53,7 +53,7 @@ "ternary-stream": "^3.0.0", "through2": "^4.0.2", "tmp": "^0.2.1", - "vscode-universal-bundler": "^0.1.0", + "vscode-universal-bundler": "^0.1.2", "workerpool": "^6.4.0", "yauzl": "^2.10.0" }, diff --git a/build/yarn.lock b/build/yarn.lock index 70a53f30bf8..d25994cedf0 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -2734,10 +2734,10 @@ vscode-gulp-watch@^5.0.3: vinyl "^2.2.0" vinyl-file "^3.0.0" -vscode-universal-bundler@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/vscode-universal-bundler/-/vscode-universal-bundler-0.1.0.tgz#1a03d1d16c6ea5065318fafbc2a554b7c2f3bd32" - integrity sha512-wtT9IZ/fqIZSirY6cxElu8a6WpNaOjgQjjazt85lMCWBuF/tWVw5nRYX67pTVsUyi6kzQaIvfyyIvxVbBpetBA== +vscode-universal-bundler@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/vscode-universal-bundler/-/vscode-universal-bundler-0.1.2.tgz#50ba7c637942dae6c0bc9bb37c0fcabf509cbca5" + integrity sha512-fboaE0933+r+qW4aRuuMwC8yle4DX6xyRDCM0otYMo5+4POZjEHbsqkPQ8H8xmhScHf1Fa7kZXYo1V2n0d2x/g== dependencies: "@electron/asar" "^3.2.7" "@malept/cross-spawn-promise" "^2.0.0" diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js index a747a7cf5dc..b3216ac0f2e 100644 --- a/src/bootstrap-window.js +++ b/src/bootstrap-window.js @@ -102,8 +102,8 @@ const isESM = false; options.beforeRequire(configuration); } - const fileRoot = `${configuration.appRoot}/out`; - globalThis._VSCODE_FILE_ROOT = fileRoot; + const baseUrl = new URL(`${fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out/`); + globalThis._VSCODE_FILE_ROOT = baseUrl.toString(); // DEV --------------------------------------------------------------------------------------- // DEV: This is for development and enables loading CSS via import-statements via import-maps. @@ -123,7 +123,6 @@ const isESM = false; style.textContent += `@import url(${url});\n`; }; - const baseUrl = new URL(`vscode-file://vscode-app${fileRoot}/`); /** * @type { { imports: Record }} */ @@ -154,13 +153,13 @@ const isESM = false; const cssModule = modulePath.replace('vs/css!', ''); const link = document.createElement('link'); link.rel = 'stylesheet'; - link.href = `${configuration.appRoot}/out/${cssModule}.css`; + link.href = new URL(`${cssModule}.css`, baseUrl).href; document.head.appendChild(link); return Promise.resolve(); } else { // ESM/JS module loading - return import(`${configuration.appRoot}/out/${modulePath}.js`); + return import(new URL(`${modulePath}.js`, baseUrl).href); } })); diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index b0688133537..a89451b8022 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -50,6 +50,7 @@ import { AccessibilityProgressSignalScheduler } from 'vs/platform/accessibilityS import { setProgressAcccessibilitySignalScheduler } from 'vs/base/browser/ui/progressbar/progressAccessibilitySignal'; import { AccessibleViewRegistry } from 'vs/platform/accessibility/browser/accessibleViewRegistry'; import { NotificationAccessibleView } from 'vs/workbench/browser/parts/notifications/notificationAccessibleView'; +import { isESM } from 'vs/base/common/amd'; export interface IWorkbenchOptions { @@ -113,7 +114,7 @@ export class Workbench extends Layout { } type AnnotatedError = AnnotatedLoadingError | AnnotatedFactoryError | AnnotatedValidationError; - if (typeof mainWindow.require?.config === 'function') { + if (!isESM && typeof mainWindow.require?.config === 'function') { mainWindow.require.config({ onError: (err: AnnotatedError) => { if (err.phase === 'loading') {