Microsoft/monaco-editor

[Bug] Instructions for integrating with Vite don't work

Open

#4045 opened on Jun 28, 2023

View on GitHub
 (7 comments) (11 reactions) (0 assignees)JavaScript (14,836 stars) (1,283 forks)batch import
bughelp wantedintegration

Description

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

No response

Reproduction Steps

Copy-paste the code from here: https://github.com/microsoft/monaco-editor/blob/main/docs/integrate-esm.md#using-vite

Actual (Problematic) Behavior

These warnings appear in the browser console:

Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq
self.MonacoEnvironment.getWorkerUrl is not a function

Expected Behavior

Code should work.

Additional Context

The warnings make perfect sense to me - the code snippet from the instructions doc doesn't define getWorkerUrl, so how is this expected to work?

Using monaco-editor version 0.28.1. Also tried version 0.36.1 with the same result.

Contributor guide