mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
Fixes vite workbench setup (#278737)
This commit is contained in:
committed by
GitHub
parent
dded867eb2
commit
7a4398bb63
@@ -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';
|
||||
|
||||
|
||||
@@ -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'
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}) {
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user