microsoft / monaco-editor

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

[Bug] v0.51.0 breaks for browser based imports #4654

Open tobiu opened 2 weeks ago

tobiu commented 2 weeks 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

upgrade from v0.50.0 to v0.51.0

Actual (Problematic) Behavior

v0.50.0 was including the script: editor/editor.main.nls.js.

this silently got removed in v0.51.0 without getting mentioned inside the release log: https://github.com/microsoft/monaco-editor/commit/e52ff427290808dff6809b3f77866ae7a62a119b

after removing the script as well inside the Neo.mjs env, i encountered several errors and warnings: Screenshot 2024-08-26 at 20 41 32

Expected Behavior

there should be no undocumented breaking changes in minor versions.

Additional Context

cross-reference ticket: https://github.com/neomjs/neo/issues/5822

hediet commented 2 weeks ago

This is because the blob context cannot load relative urls. @bpasero as discussed, we should probably make these URLs absolute.

tobiu commented 2 weeks ago

i looked a bit more into it. using v0.50.0: Screenshot 2024-08-31 at 11 54 29

i assume the monaco worker name is "javascript". we do not see the neo workers here, since we are inside the shared workers mode of the framework.

what definitely changed with v0.51.0 is that monaco is trying to use importScripts. now this is a problem, since we are inside a JS module scope. in this context, monaco should stick to use import, since importScripts can not work.

makes sense?

off topic: we have the multi-window support (without a native shell) fully working inside the Neo.mjs framework. so we can move the preview mode (mounting the widgets which get described inside the monaco editor) into different browser windows. we could also move multiple monaco editor instances into multiple windows, and they can still communicate. if it is a backlog item for you to also support multi-window, we can connect. you could save a lot of time with looking into the neo source code (MIT licensed). Screenshot 2024-08-31 at 11 59 04

bpasero commented 1 week ago

Potential fix: https://github.com/microsoft/vscode/commit/634933e5d57b1e4d62e5df92b42c9024ba232707