Skip to content

Use monaco-editor as the only Monaco package in playground-v2 - #3710

Merged
Jake Bailey (jakebailey) merged 4 commits into
microsoft:v2from
jakebailey:monaco-dedupe
Nov 21, 2026
Merged

Jake Bailey (jakebailey) merged 4 commits into
microsoft:v2from
jakebailey:monaco-dedupe

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

playground-v2 built its editor from monaco-editor-core while importing the TypeScript/JavaScript Monarch definitions, the links contribution, and the editor worker from monaco-editor. monaco-editor ships its own complete copy of the core, so the bundle carried two copies of the editor with separate service and registry instances, and both packages needed matching patches.

This switches playground-v2 to monaco-editor alone:

  • monaco-editor-core imports (from playground code and @vscode/monaco-lsp-client) resolve to monaco-editor's editor entry with its built-in CSS/HTML/JSON/TypeScript language services, bundled LSP client, and Monarch registrations removed, since those would compete with the tsgo LSP. The build fails if any of them end up in the bundle.
  • The touch gesture patch moves into patches/monaco-editor@0.56.0.patch, and the monaco-editor-core patch and dependency are removed.
  • An override removes the LSP client's monaco-editor-core peer dependency, which pnpm would otherwise install even though nothing uses it.
  • The redundant links contribution import is removed; the editor entry already registers it.
Output Before After Change
main.js 14,280,289 B 8,562,630 B -40.0%
main.css 339,673 B 236,877 B -30.3%
editor.worker.js 613,384 B 613,384 B 0%

monaco-editor-core's editor.main already registers the links
contribution through editor.all. Importing the contribution from
monaco-editor pulls in that package's separate copy of the editor core,
so the registration lands in an editor instance the playground never
uses while adding hundreds of duplicate modules to the bundle.
monaco-editor ships its own copy of the editor core, so depending on
both monaco-editor and monaco-editor-core bundles the core twice and
requires keeping two sets of patches in sync. The playground only needs
monaco-editor's Monarch definitions for TypeScript and JavaScript;
everything else can come from monaco-editor's editor entry, minus the
built-in language services, which would compete with the tsgo LSP.

The LSP client declares monaco-editor-core as a peer, which pnpm would
otherwise install alongside monaco-editor even though nothing uses it.
@jakebailey Jake Bailey (jakebailey) changed the title Bundle a single copy of Monaco core in playground-v2 Use monaco-editor as the only Monaco package in playground-v2 Nov 20, 2026
A pnpm override can remove the LSP client's monaco-editor-core peer
dependency directly, which avoids keeping a pnpmfile hook and its
lockfile checksum.
# Conflicts:
#	package.json
#	pnpm-lock.yaml
@jakebailey
Jake Bailey (jakebailey) merged commit edb62db into microsoft:v2 Nov 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants