Fixes vite workbench setup (#278737)

This commit is contained in:
Henning Dieterichs
2025-11-21 11:45:01 +01:00
committed by GitHub
parent dded867eb2
commit 7a4398bb63
5 changed files with 12 additions and 7 deletions

View File

@@ -3,6 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import './setup-dev';
import '../../src/vs/code/browser/workbench/workbench';
import './setup-dev';

View File

@@ -75,7 +75,7 @@ export class EditorWorkerService extends Disposable implements IEditorWorkerServ
const workerDescriptor = new WebWorkerDescriptor({
esmModuleLocation: () => FileAccess.asBrowserUri('vs/editor/common/services/editorWebWorkerMain.js'),
esmModuleLocationBundler: () => new URL('../../common/services/editorWebWorkerMain.ts?worker', import.meta.url),
esmModuleLocationBundler: () => new URL('../../common/services/editorWebWorkerMain.ts?workerModule', import.meta.url),
label: 'editorWorkerService'
});

View File

@@ -35,7 +35,7 @@ export class StandaloneWebWorkerService extends WebWorkerService {
}
if (!descriptor.esmModuleLocationBundler) {
throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);
throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker for the worker label: ${descriptor.label}`);
}
const url = typeof descriptor.esmModuleLocationBundler === 'function' ? descriptor.esmModuleLocationBundler() : descriptor.esmModuleLocationBundler;

View File

@@ -13,7 +13,7 @@ export class WebWorkerDescriptor {
constructor(args: {
/** The location of the esm module after transpilation */
esmModuleLocation?: URI | (() => URI);
/** The location of the esm module when used in a bundler environment. Refer to the typescript file in the src folder and use `?worker`. */
/** The location of the esm module when used in a bundler environment. Refer to the typescript file in the src folder and use `?workerModule`. */
esmModuleLocationBundler?: URL | (() => URL);
label: string;
}) {

View File

@@ -119,8 +119,13 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
console.warn(`The web worker extension host is started in a same-origin iframe!`);
}
const relativeExtensionHostIframeSrc = FileAccess.asBrowserUri(iframeModulePath);
return `${relativeExtensionHostIframeSrc.toString(true)}${suffix}`;
const relativeExtensionHostIframeSrc = this._webWorkerService.getWorkerUrl(new WebWorkerDescriptor({
esmModuleLocation: FileAccess.asBrowserUri(iframeModulePath),
esmModuleLocationBundler: new URL(`../worker/webWorkerExtensionHostIframe.html`, import.meta.url),
label: 'webWorkerExtensionHostIframe'
}));
return `${relativeExtensionHostIframeSrc}${suffix}`;
}
public async start(): Promise<IMessagePassingProtocol> {
@@ -349,5 +354,5 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
const extensionHostWorkerMainDescriptor = new WebWorkerDescriptor({
label: 'extensionHostWorkerMain',
esmModuleLocation: () => FileAccess.asBrowserUri('vs/workbench/api/worker/extensionHostWorkerMain.js'),
esmModuleLocationBundler: () => new URL('../../../api/worker/extensionHostWorkerMain.ts?worker', import.meta.url),
esmModuleLocationBundler: () => new URL('../../../api/worker/extensionHostWorkerMain.ts?workerModule', import.meta.url),
});