microsoft / microsoft/monaco-editor

[Bug] workerMain.js could not be fetched because of an invalid URL

Open
#4,699 4 comments 3 reactions 0 assignees View on GitHub

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?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#XQAAAAJaAQAAAAAAAABBqQkHQ5NjdMeMm-jY7SIQ9S7DNlzs5W-mwj0fvjqGzvklFZvqyV0JIDo5T6hJlWPPzhRqrSt6V4RUT2_-PMlF1whmj1lZN6yTi41OA-hfeCLSNrqELnEK4zh2UGQelNXrHTII8haIVV0oTZHOTBA5pgTshHkaOLPOBlLIuwKZwdY3zerRoLKF1NkyxysFYYCo_ZtpzCy1qbTdF3QWNFT73t29UIbYxtyjgPzUSqStTKd7MwHtWTwMMxbXYxt9VZMUEde7gA9OMvfSy0mPgThOWUKnsXddCAUrk8t1FxM8FnDLUV_aykyx4NBCwvbyfFT2-JHVsnr4plUvgk6BdXjpcCJ5NoHzJ-8DOL1lTZzoo_E3p2xq__7ZeII

Monaco Editor Playground Code
const tsCode = `
// Typescript

const f = async function () {
    alert('hi');
};
`;

// Hover on each property to see its docs!
const myEditor1 = monaco.editor.create(document.getElementById("container1"), {
	value: tsCode,
	language: 'typescript',
	automaticLayout: false,
});
Reproduction Steps

Just loading the provided playground URL in the browser should be enough.

Actual (Problematic) Behavior

"The browser fails to load the workerMain.js file because it attempts to fetch it from 'https://microsoft.github.io/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#editorWorkerService' instead of the correct URL 'https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#editorWorkerService'.
In other words, the URL needs to be absolute rather than relative.
Check the browser console for more info."

Expected Behavior

The resource should be fetched.

Additional Context

This bug is specific to the playground.

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.

Research direction

Open the provided Monaco Editor Playground URL and inspect how the playground requests workerMain.js. Compare the failing relative URL with the expected /monaco-editor/ path, then verify in the browser that the worker resource loads without a console error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.