-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Feature Request] ESM build that can be loaded from CDNs #4628
Labels
feature-request
Request for new features or functionality
Comments
This is not a big deal to run it through esm.sh
But yes, it's really strange that Microsoft recommends using that silly require loader instead of ESM. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context
Description
This is a suggestion to provide an ESM build that can be loaded from CDN.
Currently, the recommended way is to build the editor with a bundler and host it with the page that needs to load it. In addition it requires the user to configure the
MonacoEnvironment.getWorkerUrl
This is a bit cumbersome and exposes implementation details that the end-user does not need to be concerned with.
The other alternative is to use the loader, that loads an AMD version, which I think should no longer be the recommended way, with ESM being used across the whole eco-system. In addition, it is prone to conflicts with other libraries and getting such errors:
Error: Can only have one anonymous define call per script file
My suggestion is something like this:
Try in LiveCodes playground
This works by using a simple workaround that allows using web workers from a CDN.
I believe this can make using Monaco editor much simpler.
If you think this way is acceptable, I can start a PR to either provide such build that can just be published with the npm package or at least add docs for using something like this.
Please see the example repo:
https://github.com/hatemhosny/monaco-editor-esm-cdn
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response
The text was updated successfully, but these errors were encountered: