Reputation: 450
So I am currently trying to setup Monaco editor with this package: https://github.com/egoist/vue-monaco
It works beautifully, except for one error message:
Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq
You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker
Now I understand you need to spin up a worker, however, I can't seem to get this working properly.
I've been using Laravel & Laravel Mix to get this all working, however there seems no documentation on how to setup the worker.
Any help would be appreciated.
Upvotes: 5
Views: 7017
Reputation: 8668
I encountered this same error message. You have to configure the monaco editor webpack plugin.
Install it via npm i monaco-editor-webpack-plugin
, then add the plugin to your webpack config:
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
export default {
// ...
plugins: [new MonacoWebpackPlugin()],
}
Upvotes: 4