[Bug] Update to angular 18.2.3 gives importScripts error
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?
- [X] Not reproducible in the monaco editor playground
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response
Reproduction Steps
Have the following dependencies: "@angular/core": "18.2.3" "monaco-editor": "^0.51.0" "typescript": "^5.5.4"
Run npm install.
Import a monaco editor in to your project and add it to your dom:
Actual (Problematic) Behavior
e7ea2d78-e839-48eb-963c-a52acac188d7:1 Uncaught SyntaxError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The URL 'assets/monaco-editor/min/vs/base/worker/workerMain.js#editorWorkerService' is invalid. at e7ea2d78-e839-48eb-9…-a52acac188d7:1:337
Uncaught DOMException SyntaxError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The URL 'assets/monaco-editor/min/vs/base/worker/workerMain.js#editorWorkerService' is invalid.
at
Expected Behavior
No errors.
Additional Context
No response
Not sure if it helps, but when downgrading to monaco 0.50.0, this behavior is gone.
I have also been experiencing a similar error since version 0.51.0. When I downgrade to 0.50.0, the error disappears. The issue can be easily reproduced. If you create an editor using a language that utilizes workers, you can see the error immediately.
<!DOCTYPE html>
<html>
<head>
<script src="monaco-editor/min/vs/loader.js"></script>
<script>
require.config({ paths: { vs: 'monaco-editor/min/vs' } });
</script>
</head>
<body>
<div id="container" style="width: 500px; height: 500px;"></div>
<script>
require(['vs/editor/editor.main'], function () {
monaco.editor.create(document.getElementById('container'), {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'typescript'
});
});
</script>
</body>
</html>
I have the same issue, only downgrading helps
I have the same issue after updating to v0.51.0 of monaco-editor. My Angular version is still on v17.3.0. Downgrading to v0.50.0 of monaco-editor should not be the solution 😃
same issue here. I was getting issues with the diff editor. I could fix it by downgrading to v0.50.0 😞
I'm using angular with the config
{
"glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "/assets/monaco/"
},
Related to: https://github.com/microsoft/monaco-editor/issues/4654
I've experienced the same error when I updated from v50 to v51. After updating now from v51 to v52, the stacktrace changed but I guess the problem is the same:
Same problem with 0.52.0
use full url,see link
paths: { vs: `${location.origin}/vendors/monaco-editor/${ PRODUCTION ? 'min' : 'dev' }/vs` }