Skip to content

Instantly share code, notes, and snippets.

@dmitrizzle
Forked from davidgilbertson/client.js
Last active June 21, 2019 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitrizzle/cf4864661d432a738229029db9660bf5 to your computer and use it in GitHub Desktop.
Save dmitrizzle/cf4864661d432a738229029db9660bf5 to your computer and use it in GitHub Desktop.
import loadPolyfills from './load-polyfills';
import mountApp from './app'; // the entry point for the rest of my app
loadPolyfills().then(mountApp);
import 'core-js/es6/promise';
export default function loadPolyfills() {
const fillCoreJs = () => new Promise((resolve) => {
if (
'startsWith' in String.prototype &&
'endsWith' in String.prototype &&
'includes' in Array.prototype &&
'assign' in Object &&
'keys' in Object
) return resolve();
require.ensure([], () => {
require('core-js');
resolve();
}, 'core-js');
});
return Promise.all([
fillCoreJs()
]);
}
@dmitrizzle
Copy link
Author

Removed Fetch and i18n conditional polyfills as they are often decided by developers or are a single breakpoint that could be solved by reverting to the original code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment