The existing customWorkers functionality is great. However, it does not cover more advanced cases, where a custom language handler must be "initialized" before its worker can be used.
monaco-editor-webpack-plugin has an undocumented feature called customLanguages, which makes it possible to inject a language initializer into monaco-editor, in addition to the worker registration.
For example, monaco-yaml needs to be registered like this: https://github.com/remcohaszing/monaco-yaml#using-monaco-webpack-loader-plugin
Please note the entry: 'monaco-yaml' property there. It will inject this code snippet into monaco-editor: https://github.com/remcohaszing/monaco-yaml/blob/main/src/index.ts
If this is not done, then getWorkerUrl() never gets called for "yaml", so yaml.worker never gets loaded.
Is it possible to extend vite-plugin-monaco-editor to support this functionality?
The existing
customWorkers
functionality is great. However, it does not cover more advanced cases, where a custom language handler must be "initialized" before its worker can be used. monaco-editor-webpack-plugin has an undocumented feature calledcustomLanguages
, which makes it possible to inject a language initializer into monaco-editor, in addition to the worker registration. For example, monaco-yaml needs to be registered like this: https://github.com/remcohaszing/monaco-yaml#using-monaco-webpack-loader-plugin Please note theentry: 'monaco-yaml'
property there. It will inject this code snippet into monaco-editor: https://github.com/remcohaszing/monaco-yaml/blob/main/src/index.ts If this is not done, thengetWorkerUrl()
never gets called for "yaml", soyaml.worker
never gets loaded. Is it possible to extend vite-plugin-monaco-editor to support this functionality?