-
Notifications
You must be signed in to change notification settings - Fork 136
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
Comments
Note that this use case is kind of related to the discussion in polyfillpolyfill/polyfill-service#1210 (comment) |
Is there any reason why you can't self-host the service and serve the polyfills from your own domain? |
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 |
My use case is exactly the same one that @sheerun |
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". |
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 |
@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. |
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 theNumber.isNaN
polyfill which is used in the Set polyfill (interestingly, the new version of the Map polyfill does not use it anymore in favor ofwindow.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
andie/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.The text was updated successfully, but these errors were encountered: