At the moment, any third party polyfills or ponyfills used by or recommended to be used with dojo have to be included separately, this causes a few pain points:
inconsistency with how users are used to using other ponyfills from shim
relies on them knowing the correct packages to install from npm (or us documenting it effectively)
relies on the end user knowing how to include/use the polyfill or ponyfill
relies on the package being installed to have correct/compatible types, or an equivalent @types package
does not allow us to elide the polyfills/ponyfills based on whether they are implemented in the specific browser
To solve this the proposal is to include a number of external polyfills/ponyfills in dojo/framework and re-export them to the end user as if they were any other kind of dojo shim. For example for IntersectionObserver may look like:
The end user would then leverage @dojo/framework/shim/IntersectionObserver and use it as a ponyfill (regardless of whether it is a ponyfill or not).
From this, we can then also expand our current build capabilities to correctly include the polyfills based on whether a) they are used/imported, and b) if they are actually needed by the users browser based on a runtime check.
The text was updated successfully, but these errors were encountered: