Skip to content

Suggestion: consistent config or use browserslist for build config #10337

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

Closed
cyrilletuzi opened this issue Apr 14, 2018 · 7 comments
Closed

Suggestion: consistent config or use browserslist for build config #10337

cyrilletuzi opened this issue Apr 14, 2018 · 7 comments
Milestone

Comments

@cyrilletuzi
Copy link
Contributor

Currently the default build config is inconsistent:

  • TypeScript transpilation is set on es5 (so for IE),
  • but polyfills are set for evergreen (so not for IE),
  • and now auto-prefixer is set on IE9+ with default browserslist file in v6.

The default configuration should at least be consistent for those 3 aspects of compatibility.

I know that the TS target was stuck on es5 because of one special case (about tests I guess), I don't know if it's still a problem (@filipesilva ?).

But the CLI could do even better: now that there is an explicit default browserslist file, maybe it could use it to adapt the configuration of TS and polyfills automatically.

@filipesilva
Copy link
Contributor

I don't quite follow the logic that es5 is for IE. There's a couple of reasons for the es5 default:

So it isn't really a matter of using es5 for IE, nor of being inconsistent.

The suggestion of using browserlist to determine polyfills is already put forward in #6577 though. It's a cool idea to use it to choose a es2016 target as well. I'll mark this one as a duplicate and add that suggestion there.

@cyrilletuzi
Copy link
Contributor Author

cyrilletuzi commented Apr 16, 2018

The only thing missing in ES2015 support in modern browsers is proper tail calls, and as far as I know, it doesn't prevent from serving es2015 right now. More and more people are already doing it.

Still, the 2 other aspects (polyfills and auto-prefixer) are inconsistent: first is configured for evergreen by default and requires action for IE support, second is configured for IE by default.

@cyrilletuzi
Copy link
Contributor Author

For es2015 target, from official APF v6:

Now that all evergreen browsers natively support ES2015 (ES6), we encourage that the whole front-end ecosystem transitions over to distributing JS code at the ES2015 language level. Doing so will simplify the build process and will enable new optimizations resulting in better optimizations during packaging and minification

@filipesilva
Copy link
Contributor

I think you're right, regardless of the ES2015 question, the polyfills-browserlist question is still valid on its own.

APF recommends that ES2015 code is distributed, but that's a library packaging concern. I'm not sure it's applicable for apps. Just because evergreen browsers support ES2015 doesn't mean you want your app to be bundled to ES2015, or that you only want to support evergreen browsers. The APF recommendation just says that libraries should have that option.

@filipesilva filipesilva reopened this Apr 16, 2018
@filipesilva filipesilva added this to the v6.0.0 milestone Apr 16, 2018
@cyrilletuzi
Copy link
Contributor Author

cyrilletuzi commented Apr 16, 2018

Thanks for reopening the issue.

About ES2015, if it's recommended to distribute librairies in ES2015, it's a fortiori recommended for apps too. Otherwise, if all apps always retarget to ES5, then having the library distributed in ES2015 was not necessary in the first place.

Of course, which configuration should be enabled by default (evergreen or old browsers) would be a huge debate, with a lot of pros and cons on each side.

But a major point is: I think there is an important and good reason polyfills are configured for evergreen only by default: it's because activating all the polyfills has a huge size/performance impact. It is certainly why that choice was done in the first place. And, correct me if I'm wrong, but I don't think you'll change your mind about this (and it's good for me).

Then, as users who wants IE support have to take action for polyfills, it would be better if the other aspects (ES target and auto-prefixer) were consistent and configured for evergreen by default too.

That way, only people needing IE support would have to take action, instead of currently everyone has to take action to match their needs (of course, you can build for evergreen without taking action with the current options, but then you're not in an optimized configuration, which is one of the main goals of the CLI).

@clydin
Copy link
Member

clydin commented Apr 25, 2018

At this point in the release cycle, defaulting to ES2015 would need to be a change that could be considered for 7.0. And there are definite merits to making that change.

As to the polyfills/browserslist sync, there is now a PR for this: angular/devkit#774

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
@clydin clydin removed their assignment Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants