microsoft / microsoft/monaco-editor
[Bug] ESM Code contains require code
Open
Nobody has claimed this yet.
bug
ESM
- 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
Look at the monaco editor npm package
Actual (Problematic) Behavior
The NPM package contains require/amd code in the ESM parts of the package.
For example, look at the file: editor.api.js in the esm/vs/editor folder
if ((monacoEnvironment === null || monacoEnvironment === void 0 ? void 0 : monacoEnvironment.globalAPI) || (typeof define === 'function' && define.amd)) {
globalThis.monaco = api;
}
if (typeof globalThis.require !== 'undefined' && typeof globalThis.require.config === 'function') {
globalThis.require.config({
ignoreDuplicateModules: [
'vscode-languageserver-types',
'vscode-languageserver-types/main',
'vscode-languageserver-textdocument',
'vscode-languageserver-textdocument/main',
'vscode-nls',
'vscode-nls/vscode-nls',
'jsonc-parser',
'jsonc-parser/main',
'vscode-uri',
'vscode-uri/index',
'vs/basic-languages/typescript/typescript'
]
});
}
Expected Behavior
This code should not exist in the esm variant
Additional Context
No response
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 by inspecting esm/vs/editor/editor.api.js in the published Monaco Editor npm package and identify why the ESM variant contains the shown globalThis.require and AMD-related code. Done means the ESM output no longer contains that require/AMD code; no specific test or command is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100