Skip to content
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] Get polyfills matching multiple user agents #48

Closed
stof opened this issue Apr 5, 2018 · 7 comments
Closed

[Feature request] Get polyfills matching multiple user agents #48

stof opened this issue Apr 5, 2018 · 7 comments
Labels
feature New feature request

Comments

@stof
Copy link

stof commented Apr 5, 2018

My use case is a bit special, as I don't want to depend on the polyfill-service at runtime (my customers are big corporations, so I often need to deal with corporate firewalls based on a domain whitelist, so adding a new external domain to get polyfills is a costly choice for me).

However, I found this service quite useful when needing to find polyfills for some feature instead of doing the curation myself for each feature.
So what I did is loading https://cdn.polyfill.io/v2/polyfill.js?features=Map,Set&flags=gated&ua=android/4.2.0 and downloading the file in my project. But then, in IE 11, I also needed the Number.isNaN polyfill which is used in the Set polyfill (interestingly, the new version of the Map polyfill does not use it anymore in favor of window.isNaN but it still requires it). and so I had to identify this (comparing the list of included dependencies for ie/11.0.0 and android/4.2.0 to get missing pieces.

For my case, it would be great to be able to specify multiple user agents (android/4.2.0 and ie/11.0.0 in this case) and get the polyfills needed for any of these user agents. My use case would be to create a bundle corresponding to my baseline browsers to serve it.
the always flag does not solve my use case, as it would also include dependencies which are supported by all my baseline browsers.

@stof
Copy link
Author

stof commented Apr 5, 2018

Note that this use case is kind of related to the discussion in polyfillpolyfill/polyfill-service#1210 (comment)

@Sora2455
Copy link

Sora2455 commented Nov 3, 2018

Is there any reason why you can't self-host the service and serve the polyfills from your own domain?

@JakeChampion JakeChampion transferred this issue from polyfillpolyfill/polyfill-service Jan 23, 2019
@sheerun
Copy link

sheerun commented Jan 25, 2019

The reason for us is that we wan't to pre-bundle polygills for browsers we support and do not generate them individually for each browser

@stof
Copy link
Author

stof commented Jan 25, 2019

My use case is exactly the same one that @sheerun

@JakeChampion JakeChampion added the feature New feature request label Apr 3, 2019
@RiZKiT
Copy link

RiZKiT commented May 3, 2019

By providing no uaString and specify the features you need to polyfill, you get a bundle with these polyfills. We do it like that.

The drawback is that you loose the automatic polyfill selection, but the advance is you do not provide polyfills you may never need.

You may have a look at https://polyfill.io/v3/url-builder/ were you can find aliases for multiple combined feature sets like "es6".

@JakeChampion
Copy link
Owner

We won't be adding support for multiple user-agents, that is against the core design of this project but you can achieve what you want by doing as @RiZKiT suggest or by providing an unknown user-agent via the ua query parameter alongside the flags gated and always like so https://polyfill.io/v3/polyfill.min.js?flags=gated,always&ua=carrot.

@tdillan
Copy link

tdillan commented Sep 19, 2019

@JakeChampion would a PR that implemented support for multiple user agents be welcomed, or is such functionality considered strictly out of scope for this library?

I understand that features could be individually enumerated, but it would be a nice convenience to be able to specify broad feature sets (e.g. es2017) and rely on polyfill-library to determine the specific polyfills required to support those features for a set of user agents, while omitting those that aren't necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

6 participants