microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.68k stars 3.61k forks source link

[Feature Request] es5/es2015 bundles for esm and min builds #2915

Closed samuel-gay closed 1 year ago

samuel-gay commented 2 years ago

Context

Description

An issue occurred recently where a modestly older browser (chrome 76 - ~July 2019) in an environment (where the admins are very very reluctant to install any updates) could not use the code editor. After tracing the issue, turns out that Optional Chaining (?.) and Nullish coalescing (??) caused the browser to stop executing the monaco package (compile error, go figure). These features only began being supported in Chrome ~80 I think, around Feb 2020. Thats not that long ago (2 years).

Is this a planned dropping of support for browsers ~2+ years old? Or more of an unintended consequence of just using the latest features available to the devs?

I've seen several bug reports on the issue #2702 and #2544, and @alexdima responded with 'We don't support older browsers, we only support the latest'. For large enterprises, this is often not an option, with environments that are often years out of date.

I'm all for using the latest language features (I actually really like ?. and ??), but would it be possible to add a build for es5/es2015 even for just the 'min' build would be very helpful, so that the latest fixes and enhancements aren't accessible because you didn't want to add some additional builds to your automation pipeline to transpile from existing source code. Isn't that what automation is for, to widen your window of supported browsers for a few hours of time invested? Win win really.

Appreciate your time.

hediet commented 2 years ago

I highly recommend to update to the latest version of Chrome. The missing support for the optional chaining operator is the least problematic issue of such an old version.

Chrome 76 contains as least one security vulnerability that allows for code execution. I'm sure there are many more.

samuel-gay commented 2 years ago

Oddly, that is exactly out of my control, as I said, sometimes large enterprises have environments where they don't update often. Question, are you running on windows 11 right now? If not, why not, it's the latest version of windows, obviously has the least amount of bugs of all of the windows releases, it's hot off the build server, it's the latest.

On Mon, 24 Jan 2022, 7:31 pm Henning Dieterichs, @.***> wrote:

I highlighy recommend to update to the latest version of Chrome. The missing support for the optional chaining operator is the least problematic issue of such an old version.

Chrome 76 contains as least one security vulnerability that allows for code execution https://securelist.com/chrome-0-day-exploit-cve-2019-13720-used-in-operation-wizardopium/94866/. I'm sure there are many more.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/monaco-editor/issues/2915#issuecomment-1019840972, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTG3PAZAPD2BASTCPXPGLDUXUE7JANCNFSM5MUNWPFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

luminaxster commented 2 years ago

Not only browsers are an issue, but the plugin also breaks when used with CRA 4xx since during development and bundling node versions <14 will bark at optional chaining and nullish coalescing. The compatibility is currently too narrow.

I got the same issue, so I added babel-loader with the env preset targeting node 10 to my webpack plugin configuration and my distribution is now broadly compatible.

Perhaps changing this line to a broader range in ESBuild (e.g. "node12") may help: https://github.com/microsoft/monaco-editor/blob/75af762db9888df33cf055649316fdf3935a23e4/build/utils.js#L131

I think having multiple builds, as Samuel suggests, is really helpful for the user base.

hediet commented 1 year ago

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!