microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.01k stars 3.57k forks source link

[Bug] 0.51.0 only: Could not create web worker #4647

Closed AndersMad closed 4 days ago

AndersMad commented 1 month ago

Reproducible in vscode.dev or in VS Code Desktop?

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

Reproduction Steps

If I update from 0.50.0 to 0.51.0-rc2 I get these errors:

simpleWorker.ts:36 
 Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq
simpleWorker.ts:38 
 Uncaught SyntaxError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The URL './node_modules/monaco-editor/dev/vs/base/worker/workerMain.js#css' is invalid.
simpleWorker.ts:38 
 Uncaught SyntaxError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The URL './node_modules/monaco-editor/dev/vs/base/worker/workerMain.js#editorWorkerService' is invalid.
...

Downgrade and it works again. Using requirejs as loader - everything has worked fine for years.

I know its RC - just a heads up.

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

AndersMad commented 1 month ago

now also in 0.51.0

EdiWang commented 3 weeks ago

This is also happening on the monaco editor official website:

image

realwugang commented 1 week ago

try like this import EditorWorker from worker-loader?inline=no-fallback!./node_modules/monaco-editor/esm/vs/editor/editor.worker

mattgodbolt commented 4 days ago

We're seeing this in the released version too (0.52.0), but only on diffEditors

AndersMad commented 4 days ago

in v0.52 this has been fixed if you use absolute paths: requirejs.config({ paths: { "vs": window.location.origin + "/scripts/modelyn-editor/vs" .. (I am using requirejs) and @mattgodbolt I also tested the diff and that works fine.

mattgodbolt commented 3 days ago

@AndersMad we're using webpack; any advice on that welcomed.