-
-
Save dmitrizzle/cf4864661d432a738229029db9660bf5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import loadPolyfills from './load-polyfills'; | |
import mountApp from './app'; // the entry point for the rest of my app | |
loadPolyfills().then(mountApp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.