Skip to content

Instantly share code, notes, and snippets.

@evertbouw
Last active February 7, 2020 11:40
Show Gist options
  • Save evertbouw/177a728c70fe14b7714a03f2e1d4b512 to your computer and use it in GitHub Desktop.
Save evertbouw/177a728c70fe14b7714a03f2e1d4b512 to your computer and use it in GitHub Desktop.
How to add the create-react-app polyfill for IE11 only
  • Remove import 'react-app-polyfill/ie11' from your index.js and put it in a new file src/polyfill.js
  • install webpack-cli yarn add -D webpack-cli or npm i -D webpack-cli
  • add npm script "polyfill": "webpack -p ./src/polyfill.js -o ./build/ie11.js"
  • add to build script "build": "react-scripts build && npm run polyfill",
  • add <script src="%PUBLIC_URL%/ie11.js" nomodule></script> to the <head> of public/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment