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

[Bug] Diff demo on the project homepage doesn't work

Open stopsopa opened this issue 1 year ago • 5 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

Heats up: On the homepage the diff doesn't work

Image

Monaco Editor Playground Code


Reproduction Steps

Just go to the page: https://microsoft.github.io/monaco-editor/ and scroll to the bottom.

Diff demo doesn't work

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

stopsopa avatar Feb 25 '25 21:02 stopsopa

worker file request failed.

Image

iera2yy avatar Feb 27 '25 11:02 iera2yy

Duplicate of #4807 ?

mattgodbolt avatar Apr 15 '25 15:04 mattgodbolt

May also be related to: https://github.com/microsoft/monaco-editor/issues/4647

mattgodbolt avatar Apr 15 '25 16:04 mattgodbolt

Seems linked to CDN-based serving of content (that is; local serving works fine, but if a site pulls monaco et al from a different domain, it fails). Even using the webpack module's publicPath support it fails. (see #4807 where I linked issues we're having) This worked in v0.49 and in prior versions, so I wonder what changed.

mattgodbolt avatar Apr 15 '25 17:04 mattgodbolt

The code that thjrows is:

class DefaultWorkerFactory {
    static { this.LAST_WORKER_ID = 0; }
    constructor() {
        this._webWorkerFailedBeforeError = false;
    }
    create(desc, onMessageCallback, onErrorCallback) {
        const workerId = (++DefaultWorkerFactory.LAST_WORKER_ID);
        if (this._webWorkerFailedBeforeError) {
            throw this._webWorkerFailedBeforeError;
        }
        return new WebWorker(desc.esmModuleLocation, desc.amdModuleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => {
            logOnceWebWorkerWarning(err);
            this._webWorkerFailedBeforeError = err;
            onErrorCallback(err);
        });
    }
}

and I've tried with:

  • no publicPath -> errors as above
  • publicPath set to the CDN -> errors as above
  • publicPath set to / (per the docs this should fetch from the ORIGIN instead to work around problems) - nearly the same error except the error logged is undefined (the logOnceWebWorkerWarning...) which implies err is undefined

mattgodbolt avatar Apr 15 '25 17:04 mattgodbolt