Normal Polygamous Marriage

    This package has been deprecated

    Author message:

    This package is deprecated! We recommend using [es-dev-server]( while developing. For your production build, we recommend [@open-wc/building-rollup]( and [@open-wc/building-webpack]( These packages will handle polyfills for you automatically.


    0.3.3 • Public • Published

    Polyfills loader

    Part of Open Web Components

    Open Web Components provides a set of defaults, recommendations and tools to help facilitate your web component project. Our recommendations include: developing, linting, testing, building, tooling, demoing, publishing and automating.

    CircleCI BrowserStack Status Renovate enabled

    This package is deprecated! We recommend using es-dev-server while developing. For your production build, we recommend @open-wc/building-rollup and @open-wc/building-webpack. These packages will handle polyfills for you automatically.

    A modern loader for the web components polyfills.

    Why this loader

    The official web component polyfills ships with a loader that should be included in your index.html. The challenge with this loader is that also adds language polyfills like Promise and Symbol on browsers that require it. At best this leads to duplicate code when already including these polyfills elsewhere in your app. At worst it will conflict and crash your app. For instance, this is a known issue with babel polyfills.

    This loader seeks to solve this issue, it only loads the required web component polyfills. Additionally, the loader uses dynamic imports so that it integrates properly with your app's dependency graph. This works nicely when using the usage option on babel's polyfill transform.

    Using the loader

    The loader should be called before importing your app:

    import loadPolyfills from '@open-wc/polyfills-loader';
    loadPolyfills().then(() => import('./my-app.js'));

    If your app contains code that doesn't use any of the web component APIs, they can be imported at the same time as the loader:

    import loadPolyfills from '@open-wc/polyfills-loader';
    import './my-non-web-component-code.js';
    loadPolyfills().then(() => import('./my-web-component-code.js'));


    The web component polyfill loads:

    • Broken CustomEvent on IE11
    • HTMLTemplateElement
    • CustomElements API
    • ShadowDom API
    • URL and URLSearchParams

    The webcomponent polyfill requires:

    • Promise
    • Array.from
    • Symbol

    Make sure the required polyfills are loaded before calling the loader. If you configure babel to load these polyfills on usage, this is done automatically.

    <script> export default { mounted() { const editLink = document.querySelector('.edit-link a'); if (editLink) { const url = editLink.href; editLink.href = url.substr(0, url.indexOf('/master/')) + '/master/packages/polyfills-loader/'; } } } </script>


    npm i @open-wc/polyfills-loader

    DownloadsWeekly Downloads






    Unpacked Size

    11.5 kB

    Total Files


    Last publish


    • modern-web
    • larsdenbakker
    • d4kmor