Repository navigation
Bundle a single copy of Monaco core in playground-v2 - #3710
Open
Jake Bailey (jakebailey) wants to merge 2 commits into
Open
Jake Bailey (jakebailey) wants to merge 2 commits into
Jake Bailey (jakebailey) wants to merge 2 commits into
Conversation
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.
The Monarch language definitions and the editor worker entry come from monaco-editor, which ships its own build of the editor core under esm/vs. Bundling them as-is includes a second copy of Monaco with its own service registries, which inflates the playground bundle and misses the patch applied to monaco-editor-core. Both packages are built from the same VS Code commit, so the relative imports from monaco-editor into vs/ can resolve to the equivalent monaco-editor-core modules. The build also fails if any monaco-editor module with a monaco-editor-core counterpart ends up in the output, so a future mismatch between the two packages is caught early.
This branch has not been deployed
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.
playground-v2builds its editor frommonaco-editor-core0.56 (patched viapatches/[email protected]for touch gestures), while importing the TypeScript/JavaScript Monarch language definitions, the links contribution, and the editor worker entry frommonaco-editor0.56. Becausemonaco-editorships its own completeesm/vstree and resolves relative imports within it, the bundle included a second, unpatched copy of the Monaco core with separate service and registry instances.This change:
monaco-editor/editor/contrib/links/browser/links.jsimport, asmonaco-editor-corealready registers the links contribution througheditor.main/editor.all.js.monaco-editorintovs/to the matching modules inmonaco-editor-core(built from the same VS Code commit), and fails the build if anymonaco-editormodule with amonaco-editor-corecounterpart remains in the bundle inputs.main.jsmain.csseditor.worker.jsmonaco-editorvs/modules in bundle