microsoft / microsoft/monaco-editor

[Bug] Why is there no JavaScript ?

Open
#4,706 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

self["MonacoEnvironment"] = function(paths) {
    function stripTrailingSlash(str) {
        return str.replace(/\/$/, '');
    }

    return {
        globalAPI: false,
        getWorkerUrl: function(moduleId, label) {
            var pathPrefix = true ? __webpack_require__.p : 0;
            var result = (pathPrefix ? stripTrailingSlash(pathPrefix) + '/' : '') + paths[label];

            if (/^((http:)|(https:)|(file:)|(\/\/))/.test(result)) {
                var currentUrl = String(window.location);
                var currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length);

                if (result.substring(0, currentOrigin.length) !== currentOrigin) {
                    if (/^(\/\/)/.test(result)) {
                        result = window.location.protocol + result;
                    }

                    var js = '/*' + label + '*/importScripts("' + result + '");';
                    var blob = new Blob([js],{
                        type: 'application/javascript'
                    });
                    return URL.createObjectURL(blob);
                }
            }

            return result;
        }
    };
}({
    "editorWorkerService": "editor.worker.js",
    "css": "css.worker.js",
    "html": "html.worker.js",
    "json": "json.worker.js",
    "less": "css.worker.js",
    "scss": "css.worker.js",
    "handlebars": "html.worker.js",
    "razor": "html.worker.js"
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported setup and tracing the shown MonacoEnvironment worker configuration, especially the editor.worker.js and language worker paths. The issue names no source file, failing test, or expected behavior, so first establish what “no JavaScript” refers to; done requires a confirmed cause and a fix or reproducible explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.