Only import the editor API instead of the whole package so that Webpack only loads relevant code
When you import directly from monaco-editor webpack will pull in the entire monaco package, including all supported languages.
It is recommended to import from monaco-editor/esm/vs/editor/editor.api instead.
See: https://github.com/microsoft/monaco-editor-webpack-plugin/issues/43 for more information
This is something that you can control using webpack resolver or babel where monaco-editor can be aliased to the api file.
maybe, but thats a silly workaround to expect of users when usage of the monaco esm is implied on the immediately following line: https://github.com/brijeshb42/monaco-vim/blob/master/src/cm_adapter.js#L13
The definitively correct thing to be doing here is importing only the monaco API, and let the user pull in the full monaco package if desired in their own code.
You'll also need to update the webpack config so that the umd build works as well.
does this look correct to you?
'monaco-editor/esm/vs/editor/editor.api': {
root: 'monaco',
commonjs: 'monaco-editor/esm/vs/editor/editor.api',
commonjs2: 'monaco-editor/esm/vs/editor/editor.api',
amd: 'vs/editor/editor.api',
},
AMD version should be what it is currently. It doesn't have api file.
Can this issue be resolved? Currently my monaco-vim is bundling all the language files when it doesn't need to be and this seems like it should be good to go.
This PR can be closed as of the latest update