microsoft / microsoft/monaco-editor
[Bug] Instructions for integrating with Vite don't work
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
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?
- Not 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/integrate-esm.md#using-vite and follow its instructions using the reported Monaco Editor versions. Compare the setup with the browser console warnings, then revise the Vite integration instructions so the documented example works without the worker fallback or getWorkerUrl error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, vite
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100