-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Browserslistc and Android #31153
Comments
@hzoo we dropped Legacy Edge support in our main branch, but not when I remove Android from browserslist then Safari 10.0 fails: https://github.com/twbs/bootstrap/runs/1399985635 Any hints how to proceed with this? I'd like to get any browserslist-related changes in before we release v5.0.0-beta1 :) |
This comment has been minimized.
This comment has been minimized.
@XhmikosR Anything still to do here since we're not supporting Legacy Edge? |
Yeah, the issue is still present and we still have |
The |
The problem is two-fold AFAICT:
|
So, it seems the error we are hitting is Safari 10 throws an "Undefined is not a function" error in places like: [].concat(...element.children) |
@XhmikosR hard to validate as I can't get Safari 10 to run on my macbook but |
@alpadev thanks for testing it out :) That being said, I think the issue is that this should have been handled by Babel, shouldn't it? Also, check out my comment above; I'm not sure if there's a convention about the dist files syntax. Traditionally, we were using ES5 or even ES3. Now, on main we do use some modern APIs already. EDIT: Here's a temp branch to see the size diff:
The difference is quite big... Putting aside that it's probably a breaking change to land it now, though. |
😲 nice improvement. I wish reducing payload size was always that easy (too bad we can't get foresee the impact). I agree with you that ideally Babel should take care of code being compliant with our targeted browsers. Maybe related: babel/babel#11886 and babel/babel#8298 (Last comment here mentions this babel/rfcs#5) About the output it's hard to decide I guess.. specially if one don't know about the requirements that users might have. Maybe we should consider creating two separate bundles? One that is es5 compatible but bigger and one that targets modern browsers and is smaller? |
TBH, there shouldn't be any real impact because our supported browsers support these features. Hence why my initial plan was to move ahead with this change, but I kept hitting the test failures. Now, I have no idea if it's something in our Babel config, a bug upstream or something else. So, I kept this change back. And technically, I'm not sure if we can land the change in beta3, even if we sorted out the test failures. |
To my understanding using Babel in "loose-mode" (that's what we do I think) might result in non spec compliant code when it comes to using the spread operator with certain things.
About those tests in Safari 10.. Safari 11 was released 31.10.2017.. Considering macs usually get around 7 years of OS updates that means one needs to use a mac that is like 10+ years old to be incompatible. According to https://caniuse.com/usage-table the percentage is quite low too. Hard to say what would be the best thing to do =/ That's like the fun we frontend guys always had with the rapid development the last decade.. |
We could replace Hard to propose anything because I'd usually make such decision based on user statistics and requirements for my project. IMO if you really want to be on the safe side we would create two separate bundles. Maybe you want to create some internal poll how to proceed with that so it's not your sole responsibility 🙂 |
@XhmikosR So I investigated this topic a little further. Also I have to say thank you for giving me a reason to do this. Babel always been kinda blackbox for me TBH. You set it up. Maybe got to fiddle with the configuration because of outdated informations. Eventually you're happy with the result but after a while someone comes up with a problem that is related to this (usually some old IE in my case). So that we're on the same boat - Babel should transform our code so it's fully compliant with our targeted browsers. Although with our current configuration Babel isn't fully doing this. One reason for this is that we're using "loose mode" (source). In loose mode, the transformations do not fully conform to the ecma spec and usually result in a much simpler implementation that may not behave as intended or respect all cases. The advantage is that the resulting code is less complex and significantly smaller (~15kb for our bundle). To pick up your example from above. children(element, selector) {
return [].concat(...element.children)
.filter(child => child.matches(selector))
}
children: function children(element, selector) {
var _ref2;
return (_ref2 = []).concat.apply(_ref2, element.children).filter(function (child) {
return child.matches(selector);
});
}
children: function children(element, selector) {
var _ref2;
return (_ref2 = []).concat.apply(_ref2, _toConsumableArray(element.children)).filter(function (child) {
return child.matches(selector);
});
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
// ... Another reason. For browsers that don't support some specific JS feature, Babel can be configured to automatically add polyfills but in our case this isn't happening as well. (https://babeljs.io/docs/en/babel-preset-env#usebuiltins) About the Browserslist configuration. Babel is resolving targeted browsers with the option From the Browserslist docs:
Some background to the Android Version according to Can I Use
In our case with You can run |
If you set the If a plugin is being activated by just 1 line of code, it can be easier to just rewrite it. Unless you have In practise, I've found it easier to avoid polyfills, e.g. in for loops, not using the Aside: in |
@alpadev so this means it's expected that we get this result since we are using
That is correct, it's a side effect of using Android >= 6 since Chrome is used there too. Not sure how to proceed at this point. I mean, I definitely don't want us to disable My initial plan was to make our dist files as modern as possible for v5, but since I had trouble for months, so, I slated the change for later. |
Alright, after discussing this with @mdo, we agreed to proceed with dropping Safari < 12, thus we should be able to get dist files with modern code. I'll prepare a PR tomorrow. |
@aavmurphy you're correct. Adding @XhmikosR Yeah To further optimize Browserslist to our needs, we could utilize the
Also we could utilize https://github.com/browserslist/browserslist#configuring-for-different-environments and create a modern and a compatiblity bundle just in case you have concerns about the support. In the end Babel uses the informations provided by Browserslist to decide what transformations are necessary so the better it matches our requirements, the lesser the chances are, that there are changes to our code that could introduce errors. Hope that helps. |
I tried I think we can afford just targeting Safari > 12, see #33399. I mean, that was the initial idea for v5. What's I'm not sure about is if everything else is OK/following the best practices. Like our dist files, rollup config etc. I mean, from the looks of it, we could even drop babel. I'd say that we try to make one change at a time. We can keep babel of course, since this will allow us to use features that aren't shipped to browsers yet, just pointing it out what I notice so far. |
It might be that the
|
We don't support those browsers and the issue we are having is specific to
spread and Safari.
…On Sat, Mar 20, 2021, 15:59 Andrew Murphy ***@***.***> wrote:
It might be that the ( ) => { } syntax ("arrow functions") being replaced
causing the problem.
- that's not ios & safari <10, not opera mini, and maybe not (some of
the chinese ones)
npx ***@***.*** --update-db updates
npx browserslist
shows which browsers are being supported.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#31153 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACVLNPS3NGN3TG66MKVPSTTESS3JANCNFSM4OFUDHNQ>
.
|
Yeah sorry, from looking at the changes in the code I've been guessing that I just managed to install MacOS Yosemite on a VM and was able to install Safari 10.1.2 there. I can confirm that with
You're likely right about this. Safari 12 is able to be installed on MacOS Sierra (released in September 2016) up to Mojave (September 2018). Looks like Apple isn't really into supporting older versions of their browser but rather to keep them in line with their OS major releases once a year.
TBH I'm not very experienced with rollup because I've been using webpack most of the time. When I fiddled around to enable polyfills in Babel I ran into a problem tho, where I had to enable the
I really have no preferences about Babel. I usually add it to my build stack because it's mentioned in a lot of articles and for the lack of native support for ES6 in the past but I also had my moments when it wouldn't do what I expected. One thing to mention about features that are partly shipped yet. There is another configuration flag https://babeljs.io/docs/en/babel-preset-env#shippedproposals. In general I'm with you - if we consider dropping it we should do this step by step and the |
Huh, so it was a missing polyfill after all. It's important to enable polyfills with If it is just the spread ( If so, |
As I discovered in #30986, if I remove
Android
from .browserslistrc tests fail on Legacy Edge. For example: https://github.com/twbs/bootstrap/runs/788301337?check_suite_focus=trueThis might be an issue with Babel, opening an issue to track it.
/CC @hzoo
The text was updated successfully, but these errors were encountered: