TypeFox / monaco-components

Monaco Editor and Language Client Wrapper, plus Monaco Editor React Component
MIT License
43 stars 13 forks source link

Bundling issues with imported workers from wrapper #14

Closed msujew closed 2 years ago

msujew commented 2 years ago

When bundling the wrapper in a non-esm project, the following lines throw an error:

https://github.com/TypeFox/monaco-components/blob/90576851d8184272566581d24aeef082e26330a1/packages/monaco-editor-wrapper/src/index.ts#L14-L21

Since these workers aren't necessarily a feature of the wrapper, would it make sense to move them to a separate export that can be imported if a downstream user wants to do that? For most users, importing these workers by default does not pose any advantage.

kaisalmen commented 2 years ago

The best way forward is to move those imports to another file which imports/exports everything from the index.js (MonacoEditorLanguageClientWrapper, CodeEditorConfig, etc.). This becomes then another export in the packages.json. Also, two different bundles will be supplied (raw and raw+languages) and exported in the packages.json (see https://github.com/TypeFox/monaco-components/tree/issue-14).

Open question/requires testing is how to use/expose these extra wrapper exports in monaco-editor-comp.

kaisalmen commented 2 years ago

This has been implemented. The new default is that no additional language support is contained. You can use another export to obtain them. The same applies to the bundles: