Quantcast
Viewing all articles
Browse latest Browse all 297307

JS: Polyfills support

Problem/Motivation

Right now we don't have a solid plan for how we can handle polyfill support.

Proposed resolution

For now, I see a few options:

1. Include the appropriate polyfills manually:

We can provide one file (e.g misc/polyfills.es6.js) which includes needed polyfills (most probably used from https://github.com/zloirock/core-js).

This file will be loaded as the first one before any other JS files.

The similar approach was done by CRA.

2. Add https://polyfill.io/

What we need is just add one js file before any others:
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

But it seems polyfill.io is a good service with bad polyfills (different authors/projects which doesn't well play together).

3. Configure https://babeljs.io/docs/en/babel-polyfill

It's quite heave. But will include all needed polyfills. Need more investigation.

4. Configure https://babeljs.io/docs/en/babel-plugin-transform-runtime

This solution will add polyfills automatically only when needed (based on target browsers from babel-present-env).

But, that's something which depends on require or import - we don't support it ¯\_(ツ)_/¯

5. Any others?

Remaining tasks

1. discuss with community
2. write solution
3. review
4. 🎉


Viewing all articles
Browse latest Browse all 297307

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>