Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monaco Editor is not working #4

Open
SANTOSHKVNSP opened this issue Jun 10, 2019 · 0 comments
Open

Monaco Editor is not working #4

SANTOSHKVNSP opened this issue Jun 10, 2019 · 0 comments

Comments

@SANTOSHKVNSP
Copy link

I have tried to import monaco-editor as a shared component.

When I try to load the monaco using the below code , require is not loaded as a global function and gives the error saying config of undefined error

const onGotAmdLoader = (e?) => {
      // Load monaco
      (window).require.config({ paths: { 'vs': `assets/monaco-editor/min/vs` } });
      (window).require(['vs/editor/editor.main'], () => {
        setTimeout(() => {
          (window).monaco = monaco;
        this.monacoLoaded = true;
        this.monacoLoadedSubject.next(true);
        });
      });
    };

    // Load AMD loader if necessary
    if (!(window).require) {
      const loaderScript = document.createElement('script');
      loaderScript.type = 'text/javascript';
      loaderScript.src = '/assets/monaco-editor/min/vs/loader.js';
      loaderScript.addEventListener('load', onGotAmdLoader);
      document.body.appendChild(loaderScript);
    } else {
      onGotAmdLoader();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant