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

Console shows errors while using @sanity/code-input within the portable-text editor #13

Open
rylanharper opened this issue Aug 19, 2022 · 0 comments

Comments

@rylanharper
Copy link

rylanharper commented Aug 19, 2022

Hey there, thanks for the work that goes into making this plugin...

I am using the latest version @sanity/code-input within my sanity studio(v2). I have a type: code set within my block-text.js (portable-text) and I am receiving the following errors:

Refused to execute script from 'http://localhost:3333/studio/desk/worker-javascript.js' because its MIME type ('text/html') is not executable.

Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope'

Here is a screenshot of the error itself:
Screen Shot 2022-08-19 at 11 01 22 AM

Not sure what is going on with this here... It doesn't seem to effect anything on the client-side. The errors show up whenever I add in any type of code within the code-block editor.

Here are my package.json sanity files:

"@sanity/base": "^2.30.5",
"@sanity/code-input": "^2.30.5",
"@sanity/color-input": "^2.30.5",
"@sanity/core": "^2.30.5",
"@sanity/dashboard": "^2.30.5",
"@sanity/default-layout": "^2.30.5",
"@sanity/default-login": "^2.30.5",
"@sanity/desk-tool": "^2.30.5",
"@sanity/vision": "^2.30.5"

And here is a short version of my block-text.js file (portable-text):

export default {
  title: 'Block Text',
  name: 'blockText',
  type: 'array',
  icon: Article,
  of: [
    {
      title: 'Block',
      type: 'block',
      styles: [
        {
          title: 'Paragraph',
          value: 'normal'
        }
      ],
      // Config not important for this Github issue...
    },
    {
      title: 'Code Block',
      type: 'code',
      icon: Code,
      options: {
        theme: 'github',
        languageAlternatives: [
          { title: 'TypeScript', value: 'typescript' },
          { title: 'Javascript', value: 'javascript' },
          { title: 'HTML', value: 'html' },
          { title: 'CSS', value: 'css' },
          { title: 'SASS', value: 'sass' }
        ]
      }
    }
  ]
}

While this error doesn't affect my workflow, the console errors are somewhat annoying 😖

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