microsoft/monaco-editor

Error: Unexpected usage (integration with vue)

Closed this issue · 7 comments

languageFeatures.js?810d:85 Error: Unexpected usage
at EditorSimpleWorkerImpl.BaseEditorSimpleWorker.loadForeignModule (editorSimpleWorker.js?8c76:468)
at eval (webWorker.js?a9b4:39)

Looking for a solution...

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']
      })
    ]
  }
cdll commented

same issue here when treating with json

@soneway Have you resolved your issue?

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

tjk commented

Can this be reopened please?

@Symbolk do you understand why making that changed fixed anything?

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']
      })
    ]
  }

when i use this solution ,see microsoft/monaco-editor-webpack-plugin#96