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

monaco-graphql monaco import bundles all basic languages #2672

Closed
lokmeinmatz opened this issue Aug 14, 2022 · 2 comments · Fixed by #3285
Closed

monaco-graphql monaco import bundles all basic languages #2672

lokmeinmatz opened this issue Aug 14, 2022 · 2 comments · Fixed by #3285
Assignees

Comments

@lokmeinmatz
Copy link

The monaco-graphql package has the following import at multiple places:
import * as monaco from 'monaco-editor'

This import loads monaco-editor/esm/vs/editor/editor.main.js which in turn loads ../basic-languages/monaco.contribution which contains many of the "basic languages" supported by monaco.

When importing this language plugin, also only initializeMode like shown in the examples, all these languages are bundled. (see this minimal example using vite: https://github.com/lokmeinmatz/monaco-graphql-lang-bundles , the stats.html is generated and shows the import dependencies).

grafik

I don't have the time or expertise to create a Pull request, but is it possible to change all these imports to
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';?

Thanks, Matthias

@acao
Copy link
Member

acao commented Aug 15, 2022

Unfortunately this might not be possible because we can’t import individual monaco.languages that we need like json. This isn’t as simple as changing the worker imports as you suggest, which we switched away from because it didn’t have any impact.

A PR would be welcome though! Perhaps they have changed the way languages export. But in order to use monaco.languages.json‘s API we have to import languages, and last I checked last year at least there was no way to import just the loaded json monaco mode

Updated: to reflect that I haven’t checked the way in which monaco‘s json API is exported recently, so this has perhaps changed!

@dimaMachina
Copy link
Collaborator

dimaMachina commented Jun 24, 2023

I found a way of put off unused languages, will share soon how to do it ;)
image

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

Successfully merging a pull request may close this issue.

3 participants