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

TypeError: languageDefinitions is undefined #2738

Closed
astrolemonade opened this issue May 26, 2021 · 8 comments
Closed

TypeError: languageDefinitions is undefined #2738

astrolemonade opened this issue May 26, 2021 · 8 comments

Comments

@astrolemonade
Copy link

image

I am using vue and here is my vue.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', 'text']
      })
    ]
  }
}
@jqrun
Copy link

jqrun commented May 26, 2021

I'm facing something similar, it seems like here: https://github.com/microsoft/monaco-languages/blob/0500e21d9594b49584ef27175776d8b52f2eedc9/src/_.contribution.ts#L17

languageDefinitions is undefined as a variable inside of the exported functions. Maybe some unexpected artifact of Webpack optimization? I'm still digging into this but would be curious if anyone else finds a solution/root cause.

@jqrun
Copy link

jqrun commented May 26, 2021

One thing I did find is that this issue goes away when switching from Node 12 + Npm 6 -> Node 14 + Npm 7, though in my case I need to stay in the lower versions.

@neon64
Copy link

neon64 commented Jul 5, 2021

I can sadly reproduce this with node v16.4.0, npm v7.17.0, and webpack 5.42.0, and monaco-editor-webpack-plugin 4.0.0 and monaco-editor 0.25.2.

@Nishchit14
Copy link

This is blocking for me too... any solution here?

@goofmint
Copy link

I selected those versions and I can resolve this problem.

    "monaco-editor": "0.20.0",
    "monaco-editor-webpack-plugin": "1.9.1",
    "vue": "^2.6.11",
    "vue-monaco": "^1.2.2",

I confimed verions of node.js is v14.17.3 and v16.5.0.

@Nishchit14
Copy link

Thank you @goofmint for sharing your solution. I wish this could be possible with all latest versions.

@Nishchit14
Copy link

Nishchit14 commented Aug 23, 2021

I confirmed that it's working with the latest versions of webpack-plugins and monaco-editor.

"monaco-editor-webpack-plugin": "^4.0.0"
"monaco-editor": "^0.27.0"

problem was at react-monaco-editor, v0.34.0 works as the latest one v0.44.0 breaks

@alexdima
Copy link
Member

I'm not sure where the problem is. I think this might be a problem with react-monaco-editor.

@alexdima alexdima transferred this issue from microsoft/monaco-editor-webpack-plugin Nov 5, 2021
@alexdima alexdima closed this as completed Nov 5, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
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

6 participants