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

Uncaught Error: Unexpected usage #1384

Closed
soneway opened this issue Mar 21, 2019 · 3 comments
Closed

Uncaught Error: Unexpected usage #1384

soneway opened this issue Mar 21, 2019 · 3 comments

Comments

@soneway
Copy link

soneway commented Mar 21, 2019

Uncaught Error: Unexpected usage

Error: Unexpected usage
at EditorSimpleWorkerImpl.BaseEditorSimpleWorker.loadForeignModule (editorSimpleWorker.js?8c76:468)
at eval (webWorker.js?a9b4:39)
at eval (errors.js?0f90:57)

@Symbolk
Copy link

Symbolk commented Jul 2, 2019

My solution: Configure webpack-plugin in vue.config.js, instead of webpack.config.js:

const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')

module.exports = {
  configureWebpack: {
   plugins: [
      new MonacoWebpackPlugin({
        // available options are documented at https://github.com/Microsoft/monaco-editor-webpack-plugin#options
        languages: ['javascript', 'css', 'html', 'typescript', 'json']
      })
    ]
  }

@phyng
Copy link

phyng commented Aug 14, 2019

Maybe you use the unmatched model id, in my case:

window.MonacoEnvironment = {
  getWorkerUrl: function (moduleId, label) {
    if (label === 'json') {
      return BASE_WORKER_PATH + './json.worker.bundle.js'
    }
    if (label === 'css' || label === 'scss') { // FIX SCSS Uncaught Error: Unexpected usage
      return BASE_WORKER_PATH + './css.worker.bundle.js'
    }
    if (label === 'html') {
      return BASE_WORKER_PATH + './html.worker.bundle.js'
    }
    if (label === 'typescript' || label === 'javascript') {
      return BASE_WORKER_PATH + './ts.worker.bundle.js'
    }
    return BASE_WORKER_PATH + './editor.worker.bundle.js'
  }
}

@alexdima
Copy link
Member

Duplicate of #1385

@alexdima alexdima marked this as a duplicate of #1385 Dec 12, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants