Git Product home page Git Product logo

Comments (5)

pierogitus avatar pierogitus commented on May 14, 2024 2

The sample code for running cross origin is wrong. The variable for setting the cross origin worker url should be GlobalEnvironment, not MonacoEnvironment. See this commit microsoft/vscode@70072cb

from monaco-editor.

alexdima avatar alexdima commented on May 14, 2024

@gusdaud I am not sure what you mean. https://microsoft.github.io/monaco-editor/index.html uses the monaco-editor npm modules as it is shipped and has a HTML example:

image

Are you running your sample pages on a real protocol (such as http or https) or are you using the file protocol (the latter does not allow for web workers to be created).

[1] Chrome and Opera give an error "Uncaught SecurityError: Failed to construct 'Worker': Script at 'file:///Path/to/worker.js' cannot be accessed from origin 'null'." when you try to run a worker locally. It needs to be on a proper domain.

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Browser_compatibility

from monaco-editor.

gusdaud-zz avatar gusdaud-zz commented on May 14, 2024

Hey Alex. I'm running on http localhost and on google Chrome.

I've managed to make auto complete and other features provided by the workers to function by manually copying some files to my project such as:

\min\vs\languages\html\common\htmlWorker.js
\min\vs\languages\html\common\htmlWorker.nls.js
\min\vs\base\worker\workerMain.js

That didn't come when I NPM INSTALL Monaco.

(I had to debug the online samples to figure which files were missing)

from monaco-editor.

alexdima avatar alexdima commented on May 14, 2024

brought back in microsoft/vscode@50fabe9

from monaco-editor.

mateuslacorte avatar mateuslacorte commented on May 14, 2024

The sample code for running cross origin is wrong. The variable for setting the cross origin worker url should be GlobalEnvironment, not MonacoEnvironment. See this commit Microsoft/vscode@70072cb

Nice! Fixed here!

from monaco-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.