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

Use 'monaco-editor/esm/vs/editor/editor.api' in monaco import #26

Open
Aayush04 opened this issue Nov 21, 2022 · 1 comment
Open

Use 'monaco-editor/esm/vs/editor/editor.api' in monaco import #26

Aayush04 opened this issue Nov 21, 2022 · 1 comment

Comments

@Aayush04
Copy link

Hello,
I am facing issue in building react application having this dependency. I am getting error in with the unnecessary monaco files which II guess not required for collab extension.

Module parse failed: Unexpected token (156:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     dispose() {
|       onLanguageListener.dispose();
>       mode?.dispose();
|       mode = void 0;
|     }

If I rebuild the monaco-collab-ext with replacing import * as monaco from "monaco-editor" with import * as monaco from "monaco-editor/esm/vs/editor/editor.api" Then the above issue is not coming and everything works fine. So, my suggestion is why not to just import monaco api's instead of whole heavy monaco editor installation. If other things not required.
Also, on searching everywhere the above error could also be solved by changing webpack configuration. But my doubt is why to go into hassle of changing/overriding webpack config, if it could easliy solve by importing monaco api only.

What is the opinion about this issue?

@CGNonofr
Copy link
Contributor

CGNonofr commented Nov 21, 2022

I think you're just lucky that there is no recent syntaxes in the monaco editor api only, it may change in the future

Monaco editor doesn't transpile the code into old es5 anymore, so you have to do it yourself, and that's a good thing: you can decide your level of browser compatibility

Btw I still think it could be a good idea to not force the user to import everything from monaco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants