microsoft / microsoft/monaco-editor

The global window object is polluted after monaco-editor initialization

Open
#3,083 5 comments 5 reactions 1 assignee View on GitHub

@alexdima is already working on this.

Since Apr 25, 2022.

feature-request
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Just a possible bug I assume,

I landed in this repo by debugging https://www.npmjs.com/package/monaco-editor and its dependency on https://www.npmjs.com/package/monaco-editor-core which is basically leads to this repo. The issue is that if you try to use monaco-editor in your project (not vscode), it will pollute the global window object by setting define property in there which is leading to possible issues. For example, here in babel. As result, if I need to use babel-standalone after monaco-editor initialization, the babel check will not be invoked properly (as it will detect window.define.amd).

Is there any reason why define implementation (in here) is made on global window object?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.