Skip to content

[Bug] createWebWorker is broken in minimal distributions #5049

@haines

Description

@haines

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

Reproduction Steps

Create a minimal distribution of Monaco Editor (following e.g. https://github.com/microsoft/monaco-editor/tree/main/samples/browser-esm-webpack-small).

Specifically, don't import "monaco", but just import "monaco-editor/esm/vs/editor/editor.api.js" and any features you wish to support.

Actual (Problematic) Behavior

Calling monaco.editor.createWebWorker({ moduleId: "..." }) doesn't work any more due to microsoft/vscode#244117 and #4950.

This breaks monaco-yaml: remcohaszing/monaco-yaml#272.

import "monaco" replaces the createWebWorker function with a wrapper that converts the old IWebWorkerOptions to the new IInternalWebWorkerOptions.

However, it's not possible to import this wrapper function without importing the entirety of Monaco Editor because it is bundled into monaco-editor/esm/vs/editor/editor.main.js.

Expected Behavior

It's possible to only import the parts of Monaco Editor that you need and still have a working monaco.editor.createWebWorker function.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions