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

How to add extra Custom worker? #258

Open
faizananwerali opened this issue Jun 22, 2022 · 1 comment
Open

How to add extra Custom worker? #258

faizananwerali opened this issue Jun 22, 2022 · 1 comment

Comments

@faizananwerali
Copy link

faizananwerali commented Jun 22, 2022

I want to use https://github.com/remcohaszing/monaco-tailwindcss library along with this one. They have a configuration in which I have to add their worker. How do I do that?

From their website:

window.MonacoEnvironment = {
  getWorker(moduleId, label) {
    switch (label) {
      case 'editorWorkerService':
        return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url));
      case 'css':
      case 'less':
      case 'scss':
        return new Worker(new URL('monaco-editor/esm/vs/language/css/css.worker', import.meta.url));
      case 'handlebars':
      case 'html':
      case 'razor':
        return new Worker(
          new URL('monaco-editor/esm/vs/language/html/html.worker', import.meta.url),
        );
      case 'json':
        return new Worker(
          new URL('monaco-editor/esm/vs/language/json/json.worker', import.meta.url),
        );
      case 'javascript':
      case 'typescript':
        return new Worker(
          new URL('monaco-editor/esm/vs/language/typescript/ts.worker', import.meta.url),
        );
      case 'tailwindcss':
        return new Worker(new URL('monaco-tailwindcss/tailwindcss.worker', import.meta.url));
      default:
        throw new Error(`Unknown label ${label}`);
    }
  },
};
@YeomansIII
Copy link

Did you ever get this to work? I'm looking at add monaco-graphql.

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

2 participants