Skip to content

Instantly share code, notes, and snippets.

@endiliey
Created October 19, 2019 08:21
Show Gist options
  • Save endiliey/5f9ffc0d318becb425ea70305c6aa3c2 to your computer and use it in GitHub Desktop.
Save endiliey/5f9ffc0d318becb425ea70305c6aa3c2 to your computer and use it in GitHub Desktop.
export function getIePolyfill(siteDir: string) {
let iePolyfill = '';
const env =
process.env.NODE_ENV === 'production' ? 'production' : 'development';
const supportedBrowsers = browserslist(undefined, {path: siteDir, env});
if (
supportedBrowsers.includes('ie 9') ||
supportedBrowsers.includes('ie 10')
) {
iePolyfill = 'react-app-polyfill/ie9';
} else if (supportedBrowsers.includes('ie 11')) {
iePolyfill = 'react-app-polyfill/ie11';
}
return iePolyfill;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment