Fix the Vite worker setup in the ESM integration docs - #5480
Open
Aron Lee (aron-intframe) wants to merge 1 commit into
Open
Aron Lee (aron-intframe) wants to merge 1 commit into
Aron Lee (aron-intframe) wants to merge 1 commit into
Conversation
|
Aron Lee (@aron-intframe) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4045
Description
The Vite section of
docs/integrate-esm.mdcallsself.MonacoEnvironment.getWorkerUrlinsidegetWorker, but never defines it, so pasting the snippet yieldsself.MonacoEnvironment.getWorkerUrl is not a functionand the editor falls back to the main thread (still reproduces on monaco-editor 0.56.0 + Vite 7.3.6). Itsmonaco-editor/esm/vs/...paths also stopped resolving with the 0.56.0 exports map (#5155,./*maps to./esm/vs/*.js): Rollup fails withFailed to resolve import "monaco-editor/esm/vs/editor/editor.worker?worker".This rewrites the snippet to Vite's
?workerimports (same shape assamples/browser-esm-vite-react/src/userWorker.ts) using the paths that resolve on 0.56.0 (monaco-editor/editor/editor.worker,monaco-editor/languages/features/<lang>/<lang>.worker), and adds a one-line note with the pre-0.56 paths.Not covered here: the plain-webpack section and the
samples/browser-esm-webpack*configs still usemonaco-editor/esm/vs/...paths, which have the same resolution problem on 0.56.0.User-Facing Changes
Docs only.
Tests
Ran the snippet as extracted from the doc through
vite build/previewand the dev server in headless Chromium. Before: 0 workers, 0/0 JSON/TS markers, the error above. After: editor/json/ts workers start, 1/1 markers, diff computed, no console errors. The pre-0.56 note was checked the same way against 0.55.1.Written by an agent (Claude Code, claude-opus-5) on behalf of INTFRAME.