monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

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

Open amirrh6 opened this issue 1 year ago • 4 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [X] 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.

amirrh6 avatar Oct 01 '24 08:10 amirrh6

Can also confirm that this happens in our application when upgraded from 0.48.0 to 0.52.0.

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8080/assets/monaco/vs/base/worker/workerMain.js#editorWorkerService' failed to load.

Where the url should point to http://localhost:8080/iaf-example/iaf/gui/assets/monaco/vs/base/worker/workerMain.js instead of http://localhost:8080/assets/monaco/vs/base/worker/workerMain.js

Matthbo avatar Oct 31 '24 10:10 Matthbo

The same error happens even when you visit the home of the Monaco project https://microsoft.github.io/monaco-editor/

Just open https://microsoft.github.io/monaco-editor/ and check developer console.

Many included examples have the same issue.

mviktora avatar Nov 20 '24 21:11 mviktora

Is there any change this can get triaged?

philipsens avatar Apr 14 '25 13:04 philipsens

+1

the editor still seems to work.

Angular 19 Electron

jacoblroberts avatar Jun 01 '25 18:06 jacoblroberts