microsoft / microsoft/monaco-editor
[Bug] `monaco-editor-webpack-plugin` resolves `customLanguages` from `path.join(monacoEditorPath, "esm")` when `monacoEditorPath` is supplied
Nobody has claimed this yet.
- 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
No response
Actual (Problematic) Behavior
No response
Expected Behavior
No response
Additional Context
This is a monaco-editor-webpack-plugin bug, so it doesn't apply to the playground.
This is fairly minor, but if you supply a monacoEditorPath, it's a bit unexpected that customLanguages paths would be resolved from path.join(monacoEditorPath, "esm"). Custom languages aren't going to be "monaco paths," so I wouldn't expect any paths passed in there to need to run through resolveMonacoPath. However, the entry paths get aggregated into languagePaths here: https://github.com/microsoft/monaco-editor/blob/94c055bcbdd49f04a0fa15515e848542a79fb948/webpack-plugin/src/index.ts#L251
Then those are all run through resolveMonacoPath here: https://github.com/microsoft/monaco-editor/blob/94c055bcbdd49f04a0fa15515e848542a79fb948/webpack-plugin/src/index.ts#L312
Then, because monacoEditorPath is passed in, you hit the first condition, causing it to throw an error when trying to resolve the path from path.join(monacoEditorPath, "esm"): https://github.com/microsoft/monaco-editor/blob/94c055bcbdd49f04a0fa15515e848542a79fb948/webpack-plugin/src/index.ts#L25-L27
The same issue happens with the worker paths in getWorkerFilename: https://github.com/microsoft/monaco-editor/blob/94c055bcbdd49f04a0fa15515e848542a79fb948/webpack-plugin/src/index.ts#L49
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 in webpack-plugin/src/index.ts, reading resolveMonacoPath and the code around the reported lines where custom language and worker paths are collected and resolved. Verify the behavior when monacoEditorPath is supplied; done means customLanguages and worker paths are handled without being incorrectly resolved as Monaco paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, webpack
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100