You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using @babel/helper-define-polyfill-provider with a simple custom plugin to inject various polyfills for an application. In the documentation for createMetaResolver, it's noted:
Instance properties aren't categorized by their object, because often it's not possible to statically determine it.
I understand that, but I'm wondering if completely ignoring it is the best approach considering it's not always impossible to determine the object. And in those cases, it seems the resolver should not return a polyfill if the object does not match the desired prototype, which would save some unnecessary injections.
By ignoring it, a provider has to manually do this for example, by adding the desired object to the resolve data and then something like:
if(meta.kind==="property"&&meta.placement=== "prototype &&
meta?.object &&
meta.object !== dest.object
) {
// skip polyfill injection because object is not null and doesn't match
}
Or is that a bad idea? Although it seems like the Core JS providers already do something like this in a more roundabout way?
If I'm way off base here, please explain and feel free to close this. Otherwise I guess consider it a feature request for an API improvement.
The text was updated successfully, but these errors were encountered:
I'm using
@babel/helper-define-polyfill-provider
with a simple custom plugin to inject various polyfills for an application. In the documentation forcreateMetaResolver
, it's noted:I understand that, but I'm wondering if completely ignoring it is the best approach considering it's not always impossible to determine the object. And in those cases, it seems the resolver should not return a polyfill if the object does not match the desired prototype, which would save some unnecessary injections.
By ignoring it, a provider has to manually do this for example, by adding the desired object to the resolve data and then something like:
Or is that a bad idea? Although it seems like the Core JS providers already do something like this in a more roundabout way?
If I'm way off base here, please explain and feel free to close this. Otherwise I guess consider it a feature request for an API improvement.
The text was updated successfully, but these errors were encountered: