dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.57k forks source link

breaking change: dropping support for EcmaScript5 #46545

Closed sigmundch closed 3 years ago

sigmundch commented 3 years ago

Two years ago we announced a plan to deprecate support for ES5. Changes in priorities made us delay our plans until now.

In an upcoming Dart release (likely 2.14), dart2js will start generating code using ES6 features by default.

What can break? Apps will stop running in old browsers like IE11 that don't support these ES6 features.

Modern browsers will not be affected, dart2js continues to support the last two major releases of Edge, Safari, Firefox, and Chrome.

Mitigation Users that continue needing support on legacy browsers have two options:

For a short period we will also provide a --legacy-javascript flag that removes the modern ES6 features. The intend of this flag is to make it easy to opt-out in case bugs are discovered after the default changes, but this flag will not be kept around long term and will likely be removed one or two stable releases after this first breaking change.

@Markzipan @franklinyow @vsmenon @mit-mit @kevmoo

@grouma @Hixie - for approvals

vsmenon commented 3 years ago

lgtm

sigmundch commented 3 years ago

@grouma @Hixie - friendly ping for approvals

Hixie commented 3 years ago

What percentage of active web users will remain supported after this change?

sigmundch commented 3 years ago

We are not aware of any apps that currently rely on IE11 support anymore. @kevmoo @mariamhas - do you have any data available to verify this or data to address @Hixie's question?

FWIW, the change would align our compiler support with the messaging about supported browsers in Dart, flutter web, and internal Dart web apps.

kevmoo commented 3 years ago

According to Google's properties, MSIE is now 5x less popular than Opera. It's usage is dropping by >50% m/m

On Tue, Jul 13, 2021 at 11:33 AM sigmundch @.***> wrote:

We are not aware of any apps that currently rely on IE11 support anymore. @kevmoo https://github.com/kevmoo @mariamhas https://github.com/mariamhas - do you have any data available to verify this or data to address @Hixie https://github.com/Hixie's question?

FWIW, the change would align our compiler support with the messaging about supported browsers in Dart https://dart.dev/faq#q-what-browsers-do-you-support-as-javascript-compilation-targets, flutter web https://flutter.dev/docs/development/platform-integration/web#which-web-browsers-are-supported-by-flutter, and internal Dart web apps.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dart-lang/sdk/issues/46545#issuecomment-879310014, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEFCXESLS6KICR6IXC2ALTXSBGVANCNFSM47VV24KQ .

Hixie commented 3 years ago

That's not quite what I asked. To evaluate this proposal I am interested in comparing the fraction of users we current support, and the fraction of users we would support after this change.

vsmenon commented 3 years ago

I'm not aware of any data to that affect. We've announced and not gotten any push back.

Do we have the means to collect hard data? E.g., number of app users running with IE?

Hixie commented 3 years ago

Sorry, I meant web users in general. As in, what percentage of web users use browsers that we would still support, vs what percentage use browsers we used to support but would no longer support plus what percentage of users use browsers we already don't support.

vsmenon commented 3 years ago

I don't believe this changes from a Flutter perspective. Flutter doesn't support IE, and apps I've just tested (e.g., gallery.flutter.dev) choke in IE on the JS in index.html (not dart2js output) from template:

https://github.com/flutter/flutter/blob/76d5e62f42dffe3aba42bba9364c4469af1ff332/packages/flutter_tools/templates/app_shared/web/index.html.tmpl#L58

The number of non-Flutter web users is small, and we've checked with specific teams.

robrbecker commented 3 years ago

Workiva is probably one of the largest dart for web users (non flutter). This change is ok for us.

On Tue, Jul 13, 2021, 1:14 PM vsmenon @.***> wrote:

I don't believe this changes from a Flutter perspective. Flutter doesn't support IE, and apps I've just tested (e.g., gallery.flutter.dev) choke in IE on the JS in index.html (not dart2js output) from template:

https://github.com/flutter/flutter/blob/76d5e62f42dffe3aba42bba9364c4469af1ff332/packages/flutter_tools/templates/app_shared/web/index.html.tmpl#L58

The number of non-Flutter web users is small.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/sdk/issues/46545#issuecomment-879335184, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM32WD7UTWERETDFHE2XLTXSGBXANCNFSM47VV24KQ .

grouma commented 3 years ago

LGTM.

gmpassos commented 3 years ago

FYI:

Browser Support for ES6 (2015)

Browser Version Date
Chrome 51 May 2016
Firefox 52 Mar 2017
Edge 14 Aug 2016
Safari 10 Sep 2016
Opera 38 Jun 2016

Source: https://www.w3schools.com/js/js_versions.asp

sigmundch commented 3 years ago

@Hixie - let us know if @vsmenon comments addressed your concerns.

To provide some additional context, we have customers that don't expect their users to be on the latest versions of our supported browsers. For example, we know of a decent volume of users in browsers as old as Chrome 70.

We are evaluating each JS feature individually and advancing cautiously. At this time, we are starting with Symbol and the ES6 method syntax.

franklinyow commented 3 years ago

@Hixie Ping

msoham123 commented 3 years ago

This is looking promising, what are the performance implications of this? Faster loading times? Smaller payload sizes?

SteveAlexander commented 3 years ago

@Hixie

My estimate based on the data sources below: around 8% of desktop browser usage is currently unable to use ES6.

Desktop vs mobile is split about 50/50. To estimate mobile will need some data about mobile browser versions or mobile OS versions (seeing as iOS makes you use webkit).

This estimate is based on data from the following data sources:

  1. Worldwide browser version market share may-july 2021 (see CSV file)

https://gs.statcounter.com/browser-version-market-share#monthly-202105-202107-bar

I have no idea how reliable this data source is.

  1. Based on that file, excluding mobile browsers, and for the remainder, figuring out which support ES6. The following resources were helpful:

https://github.com/browserslist/map-to-chrome https://caniuse.com/?search=es6

vsmenon commented 3 years ago

@Hixie @ferhatb - we're still waiting on a green light on the flutter side. Any further concerns?

We're seeing a modest code size decrease (~3%) on one of our large internal web apps. Per @sigmundch 's comment, this is with fairly conservative use of ES6.

Hixie commented 3 years ago

Cutting out 8% of the potential audience seems a bit drastic, and is more than we cut off for Android and iOS. (For context, that's about 320,000,000 people and would like cutting out the entire population of the US.)

vsmenon commented 3 years ago

@Hixie - Flutter already doesn't support these browsers on the Web (independent of dart2js):

https://flutter.dev/docs/development/platform-integration/web#which-web-browsers-are-supported-by-flutter

E.g., I wasn't able to run Gallery on IE11 independent of this change.

Are you suggesting that Flutter support these older browsers?

msoham123 commented 3 years ago

@vsmenon Right, so what you are saying is that the only audience that is (potentially) being cut off is non-flutter dart users on older platforms. With that in mind, I feel like this is a reasonable trade-off (3% size decrease for dropping support for a browser replaced by the first generation of edge in 2015, 8 years ago).

Hixie commented 3 years ago

Certainly on the long term we'd want to support more browsers than we do now, but I don't know when that would happen. We have our hands full dealing with the browsers we officially support as it is.

That said, given https://dart.dev/faq#web-general this seems like something that shouldn't need any kind of approval. We should just judge this mechanically based on our stated policy.

kevmoo commented 3 years ago

To pile on here: https://aws.amazon.com/blogs/aws/heads-up-aws-support-for-internet-explorer-11-is-ending/

(Timely)

vsmenon commented 3 years ago

Thanks, all! Marking this as approved.

gmpassos commented 3 years ago

FYI:

End of IE support by Microsoft 365 online services:

https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666

"the Internet Explorer 11 desktop application will be retired and go out of support on June 15, 2022":

https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/

bernaferrari commented 3 years ago

Should this be closed now that it is in CHANGELOG?

sigmundch commented 3 years ago

Yes thank you!

The change has now landed and will be part of the Dart 2.14 stable release. The --legacy-javascript flag is still available to revert to the old behavior, but we expect to remove that flag in 2.15.

imcss4html commented 3 years ago

I have practiced it, but the effect is not good. FlutterWeb main.dart.js just reduced from 1.7M to 1.6M. any plan for continuous improvement, or am I using the wrong method?